PIC18 LaurTec Library  3.1.1
Open Source C Library for PIC18 Microcontrollers based on C18 - XC8 Compilers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
LCD_44780.c File Reference
#include "LCD_44780.h"

Go to the source code of this file.

Functions

void enable_pulse_LCD (void)
 
void send_command_LCD (unsigned char D3, unsigned char D2, unsigned char D1, unsigned char D0)
 
void home_LCD (void)
 
void shift_LCD (unsigned char shift, unsigned char number_of_shift)
 
void shift_cursor_LCD (unsigned char shift, unsigned char number_of_shift)
 
void goto_line_LCD (unsigned char line)
 
void goto_xy_LCD (unsigned char x, unsigned char y)
 
void write_char_LCD (unsigned char value)
 
void write_message_LCD (const rom unsigned char *buffer)
 
void write_string_LCD (unsigned char *buffer)
 
void write_integer_LCD (int value, unsigned char number_of_digits)
 
void clear_LCD (void)
 
void cursor_LCD (unsigned char active, unsigned char blinking)
 
void backlight_LCD (unsigned char active)
 
void initialize_LCD (unsigned char quartz_frequency)
 

Function Documentation

void backlight_LCD ( unsigned char  active)

This function controls the backligth LED.

Parameters
activeActivate the LED backlight [TURN_ON_LED_LCD, TURN_OFF_LED_LCD]
blinkingLet the cursor blink [BLINKING_ON,BLINKING_OFF]
Note
You must use the constant TURN_ON_LED_LCD, TURN_OFF_LED_LCD to ensure the compatibility with LCD_44780_I2C library.

Definition at line 269 of file LCD_44780.c.

References LCD_LED.

void clear_LCD ( void  )

This Function cleans the LCD display.

Definition at line 251 of file LCD_44780.c.

References send_command_LCD().

void cursor_LCD ( unsigned char  active,
unsigned 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 [BLINKING_ON,BLINKING_OFF]
Note
You must use the constant TURN_ON_CURSOR, TURN_OFF_CURSOR, BLINKING_ON, BLINKING_OFF to ensure the compatibility with LCD_44780_I2C library.

Definition at line 260 of file LCD_44780.c.

References send_command_LCD().

void enable_pulse_LCD ( 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 49 of file LCD_44780.c.

References delay_ms(), and LCD_E.

void goto_line_LCD ( unsigned char  line)

This function locates the LCD cursor on the selected line.

Parameters
lineSpecify the number of the line [1,2,3,4]
Warning
It might not work with all the LCD Dipslays. Tested on 20x4 16x2 LCD displays.

Definition at line 111 of file LCD_44780.c.

References send_command_LCD().

void goto_xy_LCD ( unsigned char  x,
unsigned char  y 
)

This function locates the LCD cursor to an arbitrary X Y location. Y represents the line number from top.

Parameters
xIt Specifies horizontal position
yIt Specifies vertical position (line number)
Warning
It might not work with all the LCD Dipslays. Tested on 20x4 16x2 LCD displays.

Definition at line 136 of file LCD_44780.c.

References goto_line_LCD(), RIGHT, and shift_cursor_LCD().

void home_LCD ( void  )

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

Definition at line 74 of file LCD_44780.c.

References send_command_LCD().

void initialize_LCD ( 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 277 of file LCD_44780.c.

References clear_LCD(), cursor_LCD(), delay_ms(), LCD_E, LCD_RS, LCD_RW, send_command_LCD(), and setQuartz().

void send_command_LCD ( 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 61 of file LCD_44780.c.

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

void shift_cursor_LCD ( unsigned char  shift,
unsigned 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 98 of file LCD_44780.c.

References send_command_LCD().

void shift_LCD ( unsigned char  shift,
unsigned 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 84 of file LCD_44780.c.

References send_command_LCD().

void write_char_LCD ( 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 145 of file LCD_44780.c.

References LCD_RS, and send_command_LCD().

void write_integer_LCD ( int  value,
unsigned 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 210 of file LCD_44780.c.

References write_string_LCD().

void write_message_LCD ( const rom unsigned char *  buffer)

This function writes a const string to the LCD display, e.g write_message_LCD("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 arrays refers the write_string_LCD () function.

Definition at line 174 of file LCD_44780.c.

References write_char_LCD(), and write_message_LCD().

void write_string_LCD ( 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 flash use write_message_LCD ().

Definition at line 194 of file LCD_44780.c.

References write_char_LCD().