| ??? 07/18/02 16:44 Read: times |
#26005 - RE: AT89S8252 |
Daniel,
Use the movx instruction instead of the (*(char xdata *)addr) line in C. In other words, something like the assembly version of the c code: char eeprom_read(unsigned int addr) { char eeprom_data = 0; eeprom_data = (*(char xdata *)addr); -movx A,@Ri -mov Rn,A return eeprom_data; -ret Rn } void eeprom_write(char data_value, unsigned int addr) { WMCON |= 0x10; // Set the EEMWE bit to start a write to EEPROM. -setb #EEMEN (*(char xdata *) addr) = data_value; -mov A,#data -movx A,@Ri,A WMCON &= ~0x10; // Clear the EEMWE bit to finish write. -clr #EEMEN } Clint |
| Topic | Author | Date |
| AT89S8252 | 01/01/70 00:00 | |
| RE: AT89S8252 | 01/01/70 00:00 | |
| RE: AT89S8252 | 01/01/70 00:00 | |
| RE: AT89S8252 | 01/01/70 00:00 | |
| RE: AT89S8252 | 01/01/70 00:00 | |
| RE: AT89S8252 | 01/01/70 00:00 | |
RE: AT89S8252 | 01/01/70 00:00 |



