Hi Im trying to store a 10-bit value in my eeprom of the 16f887. To write it to the eeprom it needs to be broken up into two bytes. i have used the following code but there are a few errors. could you help with the code please
char i, j;
void main() {
ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
PORTB = 0; // Initial PORTB value
TRISB = 0; // Set PORTB as output
PORTC = 0;
TRISC = 0;
j = 257;
for (i = 0; i < 1; i++)
void EEPROMWriteInt(int i, long j) // error is here***
{
byte Byte1 = ((j >> 0) & 0xFF);
byte Byte2 = ((j >> 8) & 0xFF);
EEPROM.write(i, Byte1);
EEPROM.write(i + 1, Byte2);
}
Delay_ms(50);
for (i = 0; i < 1; i++) {
PORTB = EEPROM_Read(i); // Read data and display on PORTB
PORTC = EEPROM_Read(i+1) ;
Delay_ms(500);
}
}
char i, j;
void main() {
ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
PORTB = 0; // Initial PORTB value
TRISB = 0; // Set PORTB as output
PORTC = 0;
TRISC = 0;
j = 257;
for (i = 0; i < 1; i++)
void EEPROMWriteInt(int i, long j) // error is here***
{
byte Byte1 = ((j >> 0) & 0xFF);
byte Byte2 = ((j >> 8) & 0xFF);
EEPROM.write(i, Byte1);
EEPROM.write(i + 1, Byte2);
}
Delay_ms(50);
for (i = 0; i < 1; i++) {
PORTB = EEPROM_Read(i); // Read data and display on PORTB
PORTC = EEPROM_Read(i+1) ;
Delay_ms(500);
}
}