PIC18 LaurTec Library
3.2.0
Open Source C Library for PIC18 Microcontrollers based on C18 - XC8 Compilers
|
Go to the source code of this file.
Functions | |
void | initialize_I2C_EEPROM (unsigned char crystal_frequency_MHz, unsigned int baud_rate_KHz) |
signed char | write_I2C_EEPROM (unsigned char control, unsigned int address, unsigned char data) |
signed char | write_I2C_EEPROM_check (unsigned char control, unsigned int address, unsigned char data) |
signed char | read_I2C_EEPROM (unsigned char control, unsigned int address, unsigned char *data) |
void initialize_I2C_EEPROM | ( | unsigned char | crystal_frequency_MHz, |
unsigned int | baud_rate_KHz | ||
) |
This function initialize the I2C module accordingly to the clock and baud rate.
crystal_frequency_MHz | Clock frequency expressed in MHz |
baud_rate_KHz | Baud rate expressed in KHz |
Definition at line 56 of file i2cEEPROM.c.
signed char read_I2C_EEPROM | ( | unsigned char | control, |
unsigned int | address, | ||
unsigned char * | data | ||
) |
This function reads a byte from an external I2C EEPROM.
control | Is the address of the EEPROM set with the external address pins and the internal one. The bit R/'W set to 0. (i.g 0xA0) |
address | Address where the byte must be read out [min: 0, max: depends on the EEPROM] |
*data | Address of the variable where the read data will be written into. |
Definition at line 230 of file i2cEEPROM.c.
signed char write_I2C_EEPROM | ( | unsigned char | control, |
unsigned int | address, | ||
unsigned char | data | ||
) |
This function writes a byte inside an I2C external EEPROM.
data | Byte to write [min: 0, max: 255] |
address | Address where the byte must be written [min: 0, max: depends on the EEPROM] |
control | Is the address of the EEPROM set with the external address pins and the internal one. The bit R/'W set to 0. (i.g 0xA0) |
Definition at line 69 of file i2cEEPROM.c.
signed char write_I2C_EEPROM_check | ( | unsigned char | control, |
unsigned int | address, | ||
unsigned char | data | ||
) |
This function writes a byte inside the EEPROM but it reads back the value to make sure that it has been properly written. It's slower than the other one due to this feature.
data | Byte to write [min: 0, max: 255] |
address | Address where the byte must be written [min: 0, max: depends on the EEPROM] |
control | Is the address of the EEPROM set with the external address pins and the internal one. The bit R/'W set to 0. (i.g 0xA0) |
Definition at line 198 of file i2cEEPROM.c.
References delay_ms(), read_I2C_EEPROM(), and write_I2C_EEPROM().