We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear, I'm not able to communicate with the internal EEPROM from the CC01 device. Has anybody any C-sample code that helps me get started? I'm not able to port the asm-code to C-code. Help needed.
#define EEE 0x02 #define EEE_reset 0xFD #define EEBUSY 0x01 void WaitUntilReady(void) { while ((EECON & EEBUSY) == EEBUSY); } char ReadEEPROM (unsigned int EEPROMAddress) { char xdata *p_eeprom; char ReadOut; WaitUntilReady(); EECON |= EEE; p_eeprom = (char xdata*) EEPROMAddress; ReadOut = *p_eeprom; EECON &= EEE_reset; return (ReadOut); } void CommitEEPROM (void) { WaitUntilReady(); EECON = 0x50; EECON = 0xA0; } void WriteEEPROM (unsigned int EEPROMAddress,unsigned char EepromData) { char xdata *p_eeprom; WaitUntilReady(); EECON |= EEE; p_eeprom = (char xdata*) EEPROMAddress; *p_eeprom = EepromData; EECON &= EEE_reset; CommitEEPROM(); } void main (void) { // SIMPLE WRITE & READ COMMAND WriteEEPROM (0x0001,0xAA); WriteEEPROM (0x0002,0x55); ReadEEPROM (0x0001); ReadEEPROM (0x0002); }