LTlib LaurTec Library
4.0.3
Open Source C Library for Microchip Microcontrollers based on XC8 Compiler
Main Page
Data Structures
Files
File List
Globals
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
24
IO_set_all_ports_as_inputs
();
25
26
IO_set_port_direction
(
IO_PORTD
,
IO_ALL_PORT_OUTPUT
);
27
28
I2C_EEPROM_initialize
(100);
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
}
LTlib_v_4.0.3
ex
PIC18
I2C_EEPROM
01 - I2C_EEPROM_write_and_read.X
main.c
Generated on Wed Aug 3 2016 19:57:31 for LTlib LaurTec Library by
1.8.3.1