LTlib LaurTec Library  4.0.3
Open Source C Library for Microchip Microcontrollers based on XC8 Compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
main.c
Go to the documentation of this file.
1 #include <xc.h>
2 
3 #include "LTlib.h"
4 
5 #include "module_IO.h"
6 #include "module_IO.c"
7 
8 #include "module_I2C.h"
9 #include "module_I2C.c"
10 
11 #include "LTlib_delay.h"
12 #include "LTlib_delay.c"
13 
14 #include "I2C_EEPROM.h"
15 #include "I2C_EEPROM.c"
16 
17 int main(void) {
18 
19  unsigned char EEPROM_address = 0xA0;
20  unsigned int memory_address = 0x10;
21  unsigned char write_data = 0xAA;
22  unsigned char read_data = 0x00;
23 
25 
27 
29 
30  I2C_EEPROM_write_byte (EEPROM_address, memory_address, write_data);
31 
32  //delay to make sure that the data is written before is read out
33  delay_ms (10);
34 
35  I2C_EEPROM_read_byte (EEPROM_address,memory_address, &read_data);
36 
37  IO_write_port(IO_PORTD, read_data);
38 
39  while(1);
40 }