PIC18 LaurTec Library  3.2.0
Open Source C Library for PIC18 Microcontrollers based on C18 - XC8 Compilers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
PCF8574.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3 Author : Mauro Laurenti
4 Version : 1.1
5 Created on Date : 19/03/2011
6 Last update : 02/02/2013
7 
8 CopyRight 2006/2011 all rights are reserved
9 
10 ********************************************************
11 SOFTWARE LICENSE AGREEMENT
12 ********************************************************
13 
14 The usage of the supplied software imply the acceptance of the following license.
15 
16 The software supplied herewith by Mauro Laurenti (the Author) is intended for
17 use solely and exclusively on Microchip PIC Microcontroller (registered mark).
18 The software is owned by the Author, and is protected under applicable
19 copyright laws. All rights are reserved.
20 Any use in violation of the foregoing restrictions may subject the
21 user to criminal sanctions under applicable laws, as well as to civil liability
22 for the breach of the terms and conditions of this license.
23 Commercial use is forbidden without a written acknowledgement with the Author.
24 Personal or educational use is allowed if the application containing the
25 following software doesn't aim to commercial use or monetary earning of any kind.
26 
27 THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
28 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
29 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
30 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE AUTHOR SHALL NOT,
31 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
32 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
33 
34 ********************************************************
35 PURPOSES
36 ********************************************************
37 
38 These functions allow the user to read/write to the data
39 port of the I2C I/O extender PCF8574.
40 Either PCF8574 or PCF8574A can be used. The user must use the
41 proper address calling the functions.
42 
43 PCF8574 Address : 0100xxx0
44 PCF8574A Address : 0111xxx0
45 
46 xxx = A2 A1 A0 (External Address Pins)
47 
48 *******************************************************************************/
49 
50 #ifndef PCF8574_H
51 #define PCF8574_H
52 
53 
54 #ifdef __XC8
55  #include <xc.h>
56  #ifndef _PIC18
57  #error The PCF8574 Library supports only PIC18 devices
58  #endif
59 #endif
60 
61 #include <i2c.h>
62 
78 void initialize_PCF8574 (unsigned char crystal_frequency_MHz, unsigned int baud_rate_KHz);
79 
80 
81 
101 signed char write_data_PCF8574(unsigned char control, unsigned char data );
102 #define PCF8574_write_data write_data_PCF8574
103 
123 signed char read_data_PCF8574(unsigned char control, unsigned char *data);
124 #define PCF8574_read_data read_data_PCF8574
125 
126 
127 #endif