LTlib LaurTec Library
4.0.1
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 "
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
25
IO_set_all_ports_as_inputs
();
26
27
IO_set_port_direction
(
IO_PORTD
,
IO_ALL_PORT_OUTPUT
);
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
}
LTlib_v_4.0.1
ex
PIC18
PCF8574
02 - PCF8574_4_LEDs_4_Buttons.X
main.c
Generated on Sat Mar 12 2016 11:01:40 for LTlib LaurTec Library by
1.8.3.1