LTlib LaurTec Library  4.0.0 Beta
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 "PCF8574.h"
12 #include "PCF8574.c"
13 
14 // Note
15 // The LEDs must be connected with the anode to Vcc via a resistor 560-1000 Ohm.
16 // A 0 to the PCF8574 turns on the LED.
17 // The button are conencted to ground (bit0-bit3).
18 // No pull up resistors are required
19 
20 int main(void) {
21 
22  unsigned char device_address = 0x00;
23  unsigned char data = 0xAF;
24 
26 
28 
29  PCF8574_initialize(100);
30 
31  PCF8574_write_data(device_address,data);
32 
33  while(1){
34  PCF8574_read_data(device_address, &data);
35  IO_write_port(IO_PORTD, data);
36  }
37 }