⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eeprom.c

📁 一个完整的用AVR写的电话交换机程序 希望对从事安防的开发者有用
💻 C
字号:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/wdt.h>
#include <avr/eeprom.h>
#include "main.h"

unsigned char Id1_Eeprom[cIDMax] __attribute__((section(".eeprom")));
unsigned char Id2_Eeprom[cIDMax] __attribute__((section(".eeprom")));
unsigned char Key_Eeprom[cIDMax] __attribute__((section(".eeprom")));
unsigned char Path_Eeprom[cIDMax] __attribute__((section(".eeprom")));  // Sav the senses
unsigned char Path2_Eeprom[cIDMax] __attribute__((section(".eeprom"))); // Sav the senses
unsigned char RecodeNM_Eeprom __attribute__((section(".eeprom")));
unsigned char LeftNM_Eeprom[4] __attribute__((section(".eeprom")));
//unsigned char RightNM_Eeprom[4] __attribute__((section(".eeprom")));
unsigned char ID_HEeprom __attribute__((section(".eeprom")));
unsigned char ID_LEeprom __attribute__((section(".eeprom")));
//unsigned char RFKey_Eeprom __attribute__((section(".eeprom")));


void  Eeprom_Init(void)
{
    uint8_t i;
    eeprom_busy_wait();                               //-----------网络按钮ID
	Recode_Count=eeprom_read_byte(&RecodeNM_Eeprom);
	if ( Recode_Count > cIDMax )  Recode_Count =0;

	for(i=0;i<Recode_Count;i++)
	{
	   eeprom_busy_wait();
	   Information_Id1[i]=eeprom_read_byte(Id1_Eeprom+i);
	   eeprom_busy_wait();
	   Information_Id2[i]=eeprom_read_byte(Id2_Eeprom+i);
	   eeprom_busy_wait();
	   Information_Key[i]=eeprom_read_byte(Key_Eeprom+i);
       eeprom_busy_wait();
	   Information_Path[i]=eeprom_read_byte(Path_Eeprom+i);
	   eeprom_busy_wait();
	   Information_Path2[i]=eeprom_read_byte(Path2_Eeprom+i);
    }

	for(i=0;i<4;i++)                                  //-------------设备名称
	{
	  eeprom_busy_wait();
      mName[i]=eeprom_read_byte(LeftNM_Eeprom+i);
    }
                                                     //--------------设备ID号
    eeprom_busy_wait(); mID[0]=eeprom_read_byte(&ID_HEeprom);
	eeprom_busy_wait(); mID[1]=eeprom_read_byte(&ID_LEeprom);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -