mikroC
making it simple...
Eeprom_Read
mikroC - C Compiler for Microchip PIC microcontrollers
Prototype | void Eeprom_Write(char address, char data); |
|
|
Description | Writes data to the specified address. Parameter address is of byte type, which means it |
| can address only 256 locations. For PIC18 micros with more EEPROM data locations, it |
| is programmer’s responsibility to set SFR EEADRH register appropriately. |
| Be aware that all interrupts will be disabled during execution of EEPROM_Write rou- |
| tine (GIE bit of INTCON register will be cleared). Routine will set this bit on exit. |
|
|
Requires | Requires EEPROM module. |
| Ensure minimum 20ms delay between successive use of routines Eeprom_Write and |
| Eeprom_Read. Although PIC will write the correct value, Eeprom_Read might return |
| an undefined result. |
|
|
Example | Eeprom_Write(0x32); |
|
|
Library Example
unsigned short i = 0, j = 0;
void main() { PORTB = 0; TRISB = 0;
j = 4;
for (i = 0; i < 20u; i++) Eeprom_Write(i, j++);
for (i = 0; i < 20u; i++) { PORTB = Eeprom_Read(i); Delay_ms(500);
}
}//~!
|
| page |
|
MikroElektronika: Development tools - Books - Compilers | 173 | ||
|
|