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
module_IO.h
Go to the documentation of this file.
1
/*******************************************************************************
2
3
Autore : Mauro Laurenti
4
Versione : 1.1
5
6
Created on Date : 15/01/2016
7
Last update : 25/02/2016
8
9
CopyRight 2006-2015 all rights are reserved
10
11
********************************************************
12
SOFTWARE LICENSE AGREEMENT
13
********************************************************
14
15
The usage of the supplied software imply the acceptance of the following license.
16
17
The software supplied herewith by Mauro Laurenti (the Author) is intended for
18
use solely and exclusively on Microchip PIC Microcontroller (registered mark).
19
The software is owned by the Author, and is protected under applicable
20
copyright laws. All rights are reserved.
21
Any use in violation of the foregoing restrictions may subject the
22
user to criminal sanctions under applicable laws, as well as to civil liability
23
for the breach of the terms and conditions of this license.
24
Commercial use is forbidden without a written acknowledgement with the Author.
25
Personal or educational use is allowed if the application containing the
26
following software doesn't aim to commercial use or monetary earning of any kind.
27
28
THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
29
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
30
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
31
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE AUTHOR SHALL NOT,
32
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
33
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
34
35
*******************************************************************************/
36
37
#ifndef LTLIB_IO_MODULE_H
38
#define LTLIB_IO_MODULE_H
39
40
#ifdef __XC8
41
#include <xc.h>
42
#endif
43
44
//*****************************************
45
// Library Test
46
//*****************************************
47
#include "
LTlib.h
"
48
49
#ifndef IO_LIBRARY_SUPPORTED
50
#error (LTlib) The MCU you have selected is not supported by module_IO library.
51
#endif
52
53
//*****************************************
54
// Library constants
55
//*****************************************
56
57
#define IO_PORTA 0x01
58
#define IO_PORTB 0x02
59
#define IO_PORTC 0x03
60
#define IO_PORTD 0x04
61
#define IO_PORTE 0x05
62
63
#define IO_BIT0 0x01
64
#define IO_BIT1 0x02
65
#define IO_BIT2 0x04
66
#define IO_BIT3 0x08
67
#define IO_BIT4 0x10
68
#define IO_BIT5 0x20
69
#define IO_BIT6 0x40
70
#define IO_BIT7 0x80
71
72
#define IO_ALL_PORT_OUTPUT 0x00
73
#define IO_ALL_PORT_INPUT 0xFF
74
75
#define IO_BIT0_IN 0x01
76
#define IO_BIT1_IN 0x02
77
#define IO_BIT2_IN 0x04
78
#define IO_BIT3_IN 0x08
79
#define IO_BIT4_IN 0x10
80
#define IO_BIT5_IN 0x20
81
#define IO_BIT6_IN 0x40
82
#define IO_BIT7_IN 0x80
83
84
#define IO_BIT0_OUT 0x00
85
#define IO_BIT1_OUT 0x00
86
#define IO_BIT2_OUT 0x00
87
#define IO_BIT3_OUT 0x00
88
#define IO_BIT4_OUT 0x00
89
#define IO_BIT5_OUT 0x00
90
#define IO_BIT6_OUT 0x00
91
#define IO_BIT7_OUT 0x00
92
93
94
103
void
IO_set_all_ports_as_inputs
(
void
);
104
117
void
IO_set_port_direction
(
unsigned
char
mcu_port,
port_size
port_direction);
118
119
132
void
IO_write_port
(
unsigned
char
mcu_port,
port_size
port_data);
133
134
146
port_size
IO_read_port
(
unsigned
char
mcu_port);
147
148
161
port_size
IO_read_port_bit
(
unsigned
char
mcu_port,
port_size
bit_mask );
162
163
164
175
#ifdef PULL_UP_RESISTORS_AVAILABLE
176
void
IO_enable_pull_up_resistors
(
unsigned
char
mcu_port,
port_size
resistors_to_enable);
177
#endif
178
179
180
#endif
LTlib_v_4.0.1
inc
module_IO.h
Generated on Sat Mar 12 2016 11:01:40 for LTlib LaurTec Library by
1.8.3.1