C18 LaurTec Library  2.5
Open Source C Library for PIC18 Microcontrollers
LaurTec_c18_libraries_v_2.5/inc/LCD_44780.h File Reference
#include <p18cxxx.h>
#include <delay.h>
#include <ctype.h>

Go to the source code of this file.

Defines

#define LCD_D0   LATDbits.LATD4
#define LCD_D1   LATDbits.LATD5
#define LCD_D2   LATDbits.LATD6
#define LCD_D3   LATDbits.LATD7
#define LCD_RS   LATDbits.LATD2
#define LCD_E   LATDbits.LATD3
#define LCD_RW   LATDbits.LATD1
#define LCD_LED   LATCbits.LATC1
#define LEFT   0
#define RIGHT   1
#define TURN_ON_LED   1
#define TURN_OFF_LED   0
#define TURN_ON_CURSOR   1
#define TURN_OFF_CURSOR   0
#define BLINK_ON   1
#define BLINK_OFF   0

Functions

char * itoa (int value, char *s)
void Epulse (void)
void SendCommand (unsigned char bit_3, unsigned char bit_2, unsigned char bit_1, unsigned char bit_0)
void Line2LCD (void)
void HomeLCD (void)
void ShiftLCD (char shift, char number_of_shift)
void ShiftCursorLCD (char shift, char number_of_shift)
void GotoLineLCD (char line)
void WriteCharLCD (unsigned char value)
void WriteStringLCD (const rom char *buffer)
void WriteVarLCD (unsigned char *buffer)
void WriteIntLCD (int value, char number_of_digits)
void ClearLCD (void)
void CursorLCD (char active, char blinking)
void BacklightLCD (char active)
void OpenLCD (unsigned char quartz_frequency)

Define Documentation

#define BLINK_OFF   0

Definition at line 106 of file LCD_44780.h.

#define BLINK_ON   1

Definition at line 105 of file LCD_44780.h.

#define LCD_D0   LATDbits.LATD4

This value are used as default ones

Definition at line 81 of file LCD_44780.h.

#define LCD_D1   LATDbits.LATD5

Definition at line 82 of file LCD_44780.h.

#define LCD_D2   LATDbits.LATD6

Definition at line 83 of file LCD_44780.h.

#define LCD_D3   LATDbits.LATD7

Definition at line 84 of file LCD_44780.h.

#define LCD_E   LATDbits.LATD3

Definition at line 86 of file LCD_44780.h.

#define LCD_LED   LATCbits.LATC1

Definition at line 88 of file LCD_44780.h.

#define LCD_RS   LATDbits.LATD2

Definition at line 85 of file LCD_44780.h.

#define LCD_RW   LATDbits.LATD1

Definition at line 87 of file LCD_44780.h.

#define LEFT   0

Definition at line 96 of file LCD_44780.h.

#define RIGHT   1

Definition at line 97 of file LCD_44780.h.

#define TURN_OFF_CURSOR   0

Definition at line 103 of file LCD_44780.h.

#define TURN_OFF_LED   0

Definition at line 100 of file LCD_44780.h.

#define TURN_ON_CURSOR   1

Definition at line 102 of file LCD_44780.h.

#define TURN_ON_LED   1

Definition at line 99 of file LCD_44780.h.


Function Documentation

void BacklightLCD ( char  active)

This function controls the backligth LED.

Parameters:
activeActivate the LED backlight [TURN_ON_LED, TURN_OFF_LED]
blinkingLet the cursor blink [BLINK_ON,BLINK_OFF]
Note:
You must use the constant TURN_ON_LED, TURN_OFF_LED to ensure the compatibility with LCD_44780_I2C library.

Definition at line 248 of file LCD_44780.c.

void ClearLCD ( void  )

This Function cleans the LCD display.

Definition at line 230 of file LCD_44780.c.

void CursorLCD ( char  active,
char  blinking 
)

This function controls the cursor option (blinking, active)

Parameters:
activeActivate the cursor, showing it or not [TURN_ON_CURSOR, TURN_OFF_CURSOR]
blinkingLet the cursor blink [BLINK_ON,BLINK_OFF]
Note:
You must use the constant TURN_ON_CURSOR, TURN_OFF_CURSOR, BLINK_ON, BLINK_OFF to ensure the compatibility with LCD_44780_I2C library.

Definition at line 239 of file LCD_44780.c.

void Epulse ( void  )

This function generates the Enable pulse.

Warning:
This function is a Private one. It should not be used by the user.

Definition at line 42 of file LCD_44780.c.

void GotoLineLCD ( char  line)

This function locates the LCD cursor on the selected line. Tested on 20x4 16x2 LCD displays.

Parameters:
lineSpecify the number of the line [1,2,3,4]
Warning:
It might not work with all the LCD Dipslays.

Definition at line 114 of file LCD_44780.c.

void HomeLCD ( void  )

This function locates the cursor at home location. First line first character.

Definition at line 77 of file LCD_44780.c.

char* itoa ( int  value,
char *  s 
)
void Line2LCD ( void  )

This function locates the cursor at the beginning of Line 2.

Definition at line 67 of file LCD_44780.c.

void OpenLCD ( unsigned char  quartz_frequency)

This funnction initializes the LCD to work in 4 bit modality.

Parameters:
quartz_frequencyQuartz freq. expressed in MHz used to run the CPU.
Note:
You must properly set the microcontroller pins using the TRISx registers The library requires the delay library to be included.

Definition at line 256 of file LCD_44780.c.

void SendCommand ( unsigned char  bit_3,
unsigned char  bit_2,
unsigned char  bit_1,
unsigned char  bit_0 
)

This function generates the Enable pulse.

Parameters:
bit_0bit 0 of the data bus (4 bit modality)
bit_1bit 1 of the data bus (4 bit modality)
bit_2bit 2 of the data bus (4 bit modality)
bit_3bit 3 of the data bus (4 bit modality)
Warning:
This function is a Private one. It should not be used by the user.

Definition at line 54 of file LCD_44780.c.

References Epulse(), LCD_D0, LCD_D1, LCD_D2, and LCD_D3.

void ShiftCursorLCD ( char  shift,
char  number_of_shift 
)

This function shifts the LCD cursor on the left or rigt. The position of the cursor is where the next writting will be performed.

Parameters:
shiftSpecify where the shift should be [LEFT, RIGHT].
number_of_shiftSpecify the number of times the shift is executed.
Note:
Use the constants LEFT, RIGHT to specify the direction to ensure the compatibility with LCD_44780_I2C library.

Definition at line 101 of file LCD_44780.c.

void ShiftLCD ( char  shift,
char  number_of_shift 
)

This function shifts the LCD screen on the left or rigt.

Parameters:
shiftSpecify where the shift should be [LEFT, RIGHT].
number_of_shiftSpecify the number of times the shift is executed.
Note:
Use the constants LEFT, RIGHT to specify the direction to ensure the compatibility with LCD_44780_I2C library.

Definition at line 87 of file LCD_44780.c.

void WriteCharLCD ( unsigned char  value)

This function writes a char to the LCD display. (e.g WriteCharLCD ('a'); )

Parameters:
valueSpecify the character to be sent [0-128 ASCII code].
Note:
The function accept ASCII integer or constants 'a'..'z'.

Definition at line 138 of file LCD_44780.c.

void WriteIntLCD ( int  value,
char  number_of_digits 
)

This function writes an integer to the LCD display. The integer is converted to string.

Parameters:
valueIt is integer that must be written to the LCD diplay.
numeber_of_digitsIt specifies the number of shown digit [0-5]. 0: Left Justified 1-5: Right Justified with n digit
Note:
If you set a number of digit less than required the digit will be lost starting from the less significant digit. Minus is like a digit.

Definition at line 197 of file LCD_44780.c.

void WriteStringLCD ( const rom char *  buffer)

This function writes a const string to the LCD display, e.g WriteStringLCD("Hello"); .

Parameters:
bufferIs a const string written in rom (is not an array).
Note:
The function accepts strings written in rom (constant), it does not accept array. To write array refers the WriteVarLCD () function.

Definition at line 166 of file LCD_44780.c.

void WriteVarLCD ( unsigned char *  buffer)

This function writes an array of char to the LCD display, terminated with /0 .

Parameters:
bufferIt is an array of char terminated with /0 .
Note:
The function accepts strings within an array. To use const array within rom use WriteStringLCD ().

Definition at line 181 of file LCD_44780.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines