PIC18 LaurTec Library
3.3.1
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.7
5
6
Created on Date : 04/09/2006
7
Last update : 15/12/2014
8
9
CopyRight 2006-2014 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
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 purpose 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
127
#define LEFT 0
128
#define RIGHT 1
129
#define LCD_LEFT 0
130
#define LCD_RIGHT 1
131
132
#define TURN_ON_LED_LCD 1
133
#define TURN_OFF_LED_LCD 0
134
#define LCD_TURN_ON_LED 1
135
#define LCD_TURN_OFF_LED 0
136
137
#define LCD_TURN_ON_LED 1
138
#define LCD_TURN_OFF_LED 0
139
140
141
#define TURN_ON_CURSOR 1
142
#define TURN_OFF_CURSOR 0
143
#define LCD_TURN_ON_CURSOR 1
144
#define LCD_TURN_OFF_CURSOR 0
145
146
#define BLINKING_ON 1
147
#define BLINKING_OFF 0
148
#define LCD_BLINKING_ON 1
149
#define LCD_BLINKING_OFF 0
150
151
#define ZERO_CLEANING_ON 0x01
152
#define ZERO_CLEANING_OFF 0x00
153
#define LCD_ZERO_CLEANING_ON 0x01
154
#define LCD_ZERO_CLEANING_OFF 0x00
155
156
//**************************************************
157
158
165
void
LCD_enable_pulse
(
void
);
166
#define Epulse LCD_enable_pulse
167
#define enable_pulse_LCD LCD_enable_pulse
168
169
184
void
LCD_send_command
(
unsigned
char
bit_3,
unsigned
char
bit_2,
unsigned
char
bit_1,
unsigned
char
bit_0);
185
#define SendCommand LCD_send_command
186
#define send_command_LCD LCD_send_command
187
188
193
void
LCD_home
(
void
);
194
#define HomeLCD LCD_home
195
#define home_LCD LCD_home
196
197
208
void
LCD_shift
(
unsigned
char
shift,
unsigned
char
number_of_shift);
209
#define ShiftLCD LCD_shift
210
#define shift_LCD LCD_shift
211
212
224
void
LCD_shift_cursor
(
unsigned
char
shift,
unsigned
char
number_of_shift);
225
#define ShiftCursorLCD LCD_shift_cursor
226
#define shift_cursor_LCD LCD_shift_cursor
227
228
236
void
LCD_goto_line
(
unsigned
char
line);
237
#define GotoLineLCD LCD_goto_line
238
#define goto_line_LCD LCD_goto_line
239
240
251
void
LCD_goto_xy
(
unsigned
char
x,
unsigned
char
y);
252
#define goto_xy_LCD LCD_goto_xy
253
254
262
void
LCD_write_char
(
unsigned
char
value);
263
#define WriteCharLCD LCD_write_char
264
#define write_char_LCD LCD_write_char
265
266
276
#ifndef __XC8
277
void
LCD_write_message
(
const
rom
unsigned
char
*buffer);
278
#endif
279
280
#ifdef __XC8
281
void
LCD_write_message
(
const
unsigned
char
*buffer);
282
#endif
283
284
#define WriteStringLCD LCD_write_message
285
#define write_message_LCD LCD_write_message
286
287
296
void
LCD_write_string
(
unsigned
char
*buffer);
297
#define WriteVarLCD LCD_write_string
298
#define write_string_LCD LCD_write_string
299
300
316
void
LCD_write_integer
(
int
value,
unsigned
char
number_of_digits,
unsigned
char
zero_cleaning);
317
#define WriteIntLCD LCD_write_integer
318
#define write_integer_LCD LCD_write_integer
319
320
325
void
LCD_clear
(
void
);
326
#define ClearLCD LCD_clear
327
#define clear_LCD LCD_clear
328
329
341
void
LCD_cursor
(
unsigned
char
active,
unsigned
char
blinking);
342
#define CursorLCD LCD_cursor
343
#define cursor_LCD LCD_cursor
344
345
356
void
LCD_backlight
(
unsigned
char
active);
357
#define BacklightLCD LCD_backlight
358
#define backlight_LCD LCD_backlight
359
360
370
void
LCD_initialize
(
unsigned
char
quartz_frequency);
371
#define OpenLCD LCD_initialize
372
#define initialize_LCD LCD_initialize
373
374
#endif
LaurTec_PIC_libraries_v_3.3.1
inc
LCD_44780.h
Generated on Mon Jan 25 2016 20:51:56 for PIC18 LaurTec Library by
1.8.3.1