mcjames
Newbie level 1
ext_eeprom_ready
Hi new here, was wondering if anyone could help me out:
I am using an example file by ccs for the driver. This is it:
Basically I have to change PIN_C4 and PIN_C3 to numbers mentioned in the header... once I've done that, I only get one error (as opposed to 4).
The error is
If anyone has any suggestions about how to fix this I would be grateful.
Hi new here, was wondering if anyone could help me out:
I am using an example file by ccs for the driver. This is it:
Code:
#ifndef EEPROM_SDA
#define EEPROM_SDA PIN_C4
#define EEPROM_SCL PIN_C3
#endif
#use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL)
#define EEPROM_ADDRESS long int
#define EEPROM_SIZE 2048
//This is line 52
void init_ext_eeprom() {
output_float(EEPROM_SCL);
output_float(EEPROM_SDA);
}
BOOLEAN ext_eeprom_ready() {
int1 ack;
i2c_start(); // If the write command is acknowledged,
ack = i2c_write(0xa0); // then the device is ready.
i2c_stop();
return !ack;
}
void write_ext_eeprom(long int address, BYTE data) {
while(!ext_eeprom_ready());
i2c_start();
i2c_write((0xa0|(BYTE)(address>>7))&0xfe);
i2c_write(address);
i2c_write(data);
i2c_stop();
}
BYTE read_ext_eeprom(long int address) {
BYTE data;
while(!ext_eeprom_ready());
i2c_start();
i2c_write((0xa0|(BYTE)(address>>7))&0xfe);
i2c_write(address);
i2c_start();
i2c_write((0xa0|(BYTE)(address>>7))|1);
data=i2c_read(0);
i2c_stop();
return(data);
}
Basically I have to change PIN_C4 and PIN_C3 to numbers mentioned in the header... once I've done that, I only get one error (as opposed to 4).
The error is
Code:
*** Error 128 "C:\Documents and Settings\James\My Documents\EngsclLP\WORK\PIC\Projects\EXTEEPROM\2416.C" Line 52(1,9): A #DEVICE required before this line
1 Errors, 0 Warnings.
If anyone has any suggestions about how to fix this I would be grateful.