PIC18 LaurTec Library
3.1.2
Open Source C Library for PIC18 Microcontrollers based on C18 - XC8 Compilers
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
LCD_44780.h
Go to the documentation of this file.
1
/*******************************************************************************
2
3
Author : Mauro Laurenti
4
Version : 1.6
5
6
Created on Date : 04/09/2006
7
Last update : 01/11/2013
8
9
CopyRight 2006-2013 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 acknowledgment 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
PURPOSES
38
********************************************************
39
40
41
This library contains all the functions that are handy for controlling
42
an LCD with a 44780 Hitachi controller.
43
44
To use these functions for your pourpose you must set up properly
45
the LCD constants and the pins of the PORT/s that you will use.
46
You can use any pin you want!
47
48
*******************************************************************************/
49
50
#ifndef LCD_44780_H
51
#define LCD_44780_H
52
53
#ifdef __XC8
54
#include <xc.h>
55
#include <stdlib.h>
56
#endif
57
58
#include <
delay.h
>
59
60
61
#ifndef __XC8
62
#include <ctype.h>
63
#endif
64
65
//**************************************************
66
// LCD constants
67
// All the following pins must be set as output
68
//**************************************************
69
74
#ifndef LCD_DEFAULT
75
76
#ifdef _PIC18
77
#warning LCD_D0 has been not defined, LATDbits.LATD4 will be used
78
#warning LCD_D1 has been not defined, LATDbits.LATD5 will be used
79
#warning LCD_D2 has been not defined, LATDbits.LATD6 will be used
80
#warning LCD_D3 has been not defined, LATDbits.LATD7 will be used
81
#warning LCD_RS has been not defined, LATDbits.LATD2 will be used
82
#warning LCD_E has been not defined, LATDbits.LATD3 will be used
83
#warning LCD_RW has been not defined, LATDbits.LATD1 will be used
84
#warning LCD_LED has been not defined, LATCbits.LATC1 will be used
85
#endif
86
87
#ifndef _PIC18
88
#warning LCD_D0 has been not defined, PORTDbits.RD4 will be used
89
#warning LCD_D1 has been not defined, PORTDbits.RD5 will be used
90
#warning LCD_D2 has been not defined, PORTDbits.RD6 will be used
91
#warning LCD_D3 has been not defined, PORTDbits.RD7 will be used
92
#warning LCD_RS has been not defined, PORTDbits.RD2 will be used
93
#warning LCD_E has been not defined, PORTDbits.RD3 will be used
94
#warning LCD_RW has been not defined, PORTDbits.RD1 will be used
95
#warning LCD_LED has been not defined, PORTCbits.RC1 will be used
96
#endif
97
98
#endif
99
#ifdef _PIC18
100
#define LCD_D0 LATDbits.LATD4
101
#define LCD_D1 LATDbits.LATD5
102
#define LCD_D2 LATDbits.LATD6
103
#define LCD_D3 LATDbits.LATD7
104
#define LCD_RS LATDbits.LATD2
105
#define LCD_E LATDbits.LATD3
106
#define LCD_RW LATDbits.LATD1
107
#define LCD_LED LATCbits.LATC1
108
#endif
109
110
#ifndef _PIC18
111
#define LCD_D0 PORTDbits.RD4
112
#define LCD_D1 PORTDbits.RD5
113
#define LCD_D2 PORTDbits.RD6
114
#define LCD_D3 PORTDbits.RD7
115
#define LCD_RS PORTDbits.RD2
116
#define LCD_E PORTDbits.RD3
117
#define LCD_RW PORTDbits.RD1
118
#define LCD_LED PORTCbits.RC1
119
#endif
120
121
122
123
//**************************************************
124
// Constant Definitions
125
126
#define LEFT 0
127
#define RIGHT 1
128
129
#define TURN_ON_LED_LCD 1
130
#define TURN_OFF_LED_LCD 0
131
132
#define TURN_ON_CURSOR 1
133
#define TURN_OFF_CURSOR 0
134
135
#define BLINKING_ON 1
136
#define BLINKING_OFF 0
137
138
//**************************************************
139
140
147
void
enable_pulse_LCD
(
void
);
148
#define Epulse enable_pulse_LCD
149
150
165
void
send_command_LCD
(
unsigned
char
bit_3,
unsigned
char
bit_2,
unsigned
char
bit_1,
unsigned
char
bit_0);
166
#define SendCommand send_command_LCD
167
168
173
void
home_LCD
(
void
);
174
#define HomeLCD home_LCD
175
176
187
void
shift_LCD
(
unsigned
char
shift,
unsigned
char
number_of_shift);
188
#define ShiftLCD shift_LCD
189
190
202
void
shift_cursor_LCD
(
unsigned
char
shift,
unsigned
char
number_of_shift);
203
#define ShiftCursorLCD shift_cursor_LCD
204
205
213
void
goto_line_LCD
(
unsigned
char
line);
214
#define GotoLineLCD goto_line_LCD
215
216
227
void
goto_xy_LCD
(
unsigned
char
x,
unsigned
char
y);
228
229
237
void
write_char_LCD
(
unsigned
char
value);
238
#define WriteCharLCD write_char_LCD
239
240
250
#ifndef __XC8
251
void
write_message_LCD
(
const
rom
unsigned
char
*buffer);
252
#endif
253
254
#ifdef __XC8
255
void
write_message_LCD
(
const
unsigned
char
*buffer);
256
#endif
257
258
#define WriteStringLCD write_message_LCD
259
260
269
void
write_string_LCD
(
unsigned
char
*buffer);
270
#define WriteVarLCD write_string_LCD
271
272
286
void
write_integer_LCD
(
int
value,
unsigned
char
number_of_digits);
287
#define WriteIntLCD write_integer_LCD
288
289
294
void
clear_LCD
(
void
);
295
#define ClearLCD clear_LCD
296
297
309
void
cursor_LCD
(
unsigned
char
active,
unsigned
char
blinking);
310
#define CursorLCD cursor_LCD
311
312
323
void
backlight_LCD
(
unsigned
char
active);
324
#define BacklightLCD backlight_LCD
325
326
336
void
initialize_LCD
(
unsigned
char
quartz_frequency);
337
#define OpenLCD initialize_LCD
338
339
#endif
LaurTec_PIC_libraries_v_3.1.2
inc
LCD_44780.h
Generated on Sat Nov 23 2013 13:16:03 for PIC18 LaurTec Library by
1.8.3.1