Abl-electronic PIC Microcontrollers PIC16 Bedienungsanleitung Seite 181

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 312
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 180
MikroElektronika:
Development
tools
-
Books
-
Compilers
173
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
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 programmers 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);
Eeprom_Read
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);
}
}//~!
Library Example
Seitenansicht 180
1 2 ... 176 177 178 179 180 181 182 183 184 185 186 ... 311 312

Kommentare zu diesen Handbüchern

Keine Kommentare