?? ee_module.c
字號:
unsigned char eedata_readbyte(unsigned char addr){ EEADR = addr; EEPGD = 0; CFGS = 0; RD = 1; return(EEDATA);}//non- interrupt driven writesvoid eedata_writebyte(unsigned char addr, unsigned char byte){ char istat; EEADR = addr; EEDATA = byte; EEPGD = 0; CFGS = 0; WREN = 1; istat = GIE; GIE = 0; EECON2 = 0x55; EECON2 = 0xAA; WR=1; GIE = istat; // reenable interrupt while (WR) ; // wait for write to complete EEIF = 0; WREN = 0; //clear interrupt flag, write enable}//Write string to DATA EEPROMchar eedata_writestr(unsigned char *s, unsigned char addr){ char c; while(*s) { eedata_writebyte(addr,*s); // verify c = eedata_readbyte(addr); if (c != *s) return(1); addr++; s++; } // write end of string eedata_writebyte(addr,*s); c = eedata_readbyte(addr); if (c != *s) return(1); return(0);}//Read string from DATA EEPROMunsigned char eedata_readstr(unsigned char *s, unsigned char addr, unsigned char max){ unsigned char c,cnt; cnt = 0; do { c = eedata_readbyte(addr); addr++; *s = c; s++; cnt++; }while((c) && (cnt < (max-1))); // last byte non-zero, terminate this string if (c) *s = 0; return(addr);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -