C18 LaurTec Library  2.5
Open Source C Library for PIC18 Microcontrollers
LaurTec_c18_libraries_v_2.5/inc/LCD_44780.h
Go to the documentation of this file.
00001 /**********************************************************************************************
00002 
00003 Author : Mauro Laurenti
00004 Version : 1.1
00005 Date : 4/9/2006
00006 Last Update: 09/03/2012
00007  
00008 CopyRight 2006-2012 all rights are reserved
00009 
00010 ********************************************************
00011 SOFTWARE LICENSE AGREEMENT
00012 ********************************************************
00013 
00014 The usage of the supplied software imply the acceptance of the following license.
00015 
00016 The software supplied herewith by Mauro Laurenti (the Author) 
00017 is intended for use solely and exclusively on Microchip PIC Microcontroller (registered mark).  
00018 The software is owned by the Author, and is protected under applicable copyright laws. 
00019 All rights are reserved. 
00020 Any use in violation of the foregoing restrictions may subject the 
00021 user to criminal sanctions under applicable laws (Italian or International ones), as well as to 
00022 civil liability for the breach of the terms and conditions of this license. 
00023 Commercial use is forbidden without a written acknowledgment with the Author.
00024 Personal or educational use is allowed if the application containing the following 
00025 software doesn't aim to commercial use or monetary earning of any kind.    
00026 
00027 THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, 
00028 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED 
00029 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
00030 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE AUTHOR SHALL NOT, 
00031 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR 
00032 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
00033 
00034 ********************************************************
00035 PURPOSES
00036 ********************************************************
00037 
00038 
00039  This library contains all the functions that are handy for controlling                         
00040  an LCD with a 44780 Hitachi controller.                                                        
00041         
00042  To use these functions for your pourpose you must set up properly 
00043  the LCD constants and the pins of the PORT/s that you will use.
00044  You can use any pin you want!
00045 
00046 **********************************************************************************************/
00047 
00048 #include <p18cxxx.h>
00049 #include <delay.h>
00050 #include <ctype.h>
00051 
00052 
00053 #ifndef FLAG_LCD_44780
00054 #define FLAG_LCD_44780
00055 
00056 // Prototipe for itoa from ctype lib 
00057 char *itoa (int value, char *s);
00058 
00059 //**************************************************
00060 // LCD constants
00061 // All the following pins must be set as output
00062 //**************************************************
00063 
00068 #ifndef LCD_DEFAULT
00069 
00070         #warning LCD_D0 has been not defined, LATDbits.LATD4 will be used
00071         #warning LCD_D1 has been not defined, LATDbits.LATD5 will be used
00072         #warning LCD_D2 has been not defined, LATDbits.LATD6 will be used
00073         #warning LCD_D3 has been not defined, LATDbits.LATD7 will be used
00074         #warning LCD_RS has been not defined, LATDbits.LATD2 will be used
00075         #warning LCD_E has been not defined, LATDbits.LATD3 will be used
00076         #warning LCD_RW has been not defined, LATDbits.LATD1 will be used
00077         #warning LCD_LED has been not defined, LATCbits.LATC1 will be used
00078         
00079 #endif
00080 
00081         #define LCD_D0 LATDbits.LATD4
00082         #define LCD_D1 LATDbits.LATD5
00083         #define LCD_D2 LATDbits.LATD6   
00084         #define LCD_D3 LATDbits.LATD7   
00085         #define LCD_RS LATDbits.LATD2
00086         #define LCD_E LATDbits.LATD3    
00087         #define LCD_RW LATDbits.LATD1   
00088         #define LCD_LED LATCbits.LATC1  
00089         
00090         
00091 
00092 
00093 //**************************************************
00094 //               Constant Definitions
00095 
00096 #define LEFT 0
00097 #define RIGHT 1
00098 
00099 #define TURN_ON_LED 1
00100 #define TURN_OFF_LED 0
00101 
00102 #define TURN_ON_CURSOR 1
00103 #define TURN_OFF_CURSOR 0
00104 
00105 #define BLINK_ON 1
00106 #define BLINK_OFF 0
00107 
00108 //**************************************************
00109 
00110 
00117 void Epulse (void);
00118 
00119 
00134 void SendCommand (unsigned char bit_3, unsigned char bit_2, unsigned char bit_1, unsigned char bit_0);
00135 
00136 
00141 void Line2LCD(void);
00142 
00143 
00148 void HomeLCD(void);
00149 
00150 
00161 void ShiftLCD(char shift, char number_of_shift);
00162 
00163 
00175 void ShiftCursorLCD(char shift, char number_of_shift);
00176 
00177 
00185 void GotoLineLCD (char line);
00186 
00187 
00195 void WriteCharLCD (unsigned char value);
00196 
00197 
00207 void WriteStringLCD(const rom char *buffer);
00208 
00209 
00218 void WriteVarLCD(unsigned char *buffer);
00219 
00220 
00234 void WriteIntLCD(int value, char number_of_digits);
00235 
00236 
00241 void ClearLCD (void);
00242 
00243 
00255 void CursorLCD(char active,char blinking);
00256 
00257 
00268 void BacklightLCD(char active);
00269 
00270 
00280 void  OpenLCD(unsigned char quartz_frequency);
00281 
00282 
00283 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines