I've written a test program in the past to try my hand at writing to and reading from the EEPROM. The program was successful, I was able to store information in the EEPROM and read that value back after a hard reset of the device. Problem is, I would like to know how it works so I can better understand what I'm asking the program to do.
I'm using MPLAB IDE with the High-Tech C-Lite compiler, writing my program in the C language using a PIC MCU. The test program was written for the 16F628A, but my target device is the 12F629.
The manual for the C-Lite compiler basically shows an example:
Can you tell me, does the variable "address" simply access the first available address of the EEPROM memory? Should this be written as a physical memory address, such as 0Bh or what?
What format is the variable "value" in? I understand that the line eeprom_write (address, value); places whatever value "value" has into the location "address", but is the line value = 1 placing a decimal 1 or what? If I use a command later in the program that says to increment value (e.g. value++), would the next value used be "2"?
Thanks all.
I'm using MPLAB IDE with the High-Tech C-Lite compiler, writing my program in the C language using a PIC MCU. The test program was written for the 16F628A, but my target device is the 12F629.
The manual for the C-Lite compiler basically shows an example:
Rich (BB code):
#include <htc.h>
void eetest (void) {
unsigned char value = 1;
unsigned char address = 0;
// write value to EEPROM address
eeprom_write (address, value);
// read from EEPROM at address
value = eeprom_read (address);
}
What format is the variable "value" in? I understand that the line eeprom_write (address, value); places whatever value "value" has into the location "address", but is the line value = 1 placing a decimal 1 or what? If I use a command later in the program that says to increment value (e.g. value++), would the next value used be "2"?
Thanks all.