PIC18 LaurTec Library  3.3.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_I2C.c File Reference
#include "LCD_44780_I2C.h"
#include "PCF8574.h"
#include "delay.h"

Go to the source code of this file.

Functions

void LCD_enable_pulse (void)
 
void LCD_send_command (unsigned char data)
 
void LCD_home (void)
 
void LCD_shift (unsigned char shift, unsigned char number_of_shift)
 
void LCD_shift_cursor (unsigned char shift, unsigned char number_of_shift)
 
void LCD_goto_line (unsigned char line)
 
void LCD_goto_xy (unsigned char x, unsigned char y)
 
void LCD_write_char (unsigned char value)
 
void LCD_write_message (const rom unsigned char *buffer)
 
void LCD_write_string (unsigned char *buffer)
 
void LCD_write_integer (int value, unsigned char number_of_digits)
 
void LCD_clear (void)
 
void LCD_cursor (unsigned char active, unsigned char blinking)
 
void LCD_backlight (unsigned char active)
 
void LCD_initialize (unsigned unsigned char quartz_frequency)
 

Variables

unsigned char data_buffer = 0
 
unsigned char PCF8574_address = 0
 

Function Documentation

void LCD_backlight ( unsigned char  active)

This function controls the backligth LED.

Parameters
activeActivate the LED backlight [LCD_TURN_ON_LED, LCD_TURN_OFF_LED]
blinkingLet the cursor blink [LCD_BLINKING_ON, LCD_BLINKING_OFF]
Note
You must use the constant LCD_TURN_ON_LED, LCD_TURN_OFF_LED to ensure the compatibility with LCD_44780_I2C library.

Definition at line 274 of file LCD_44780_I2C.c.

References data_buffer, LCD_TURN_ON_LED, PCF8574_address, and write_data_PCF8574.

void LCD_clear ( void  )

This Function cleans the LCD display.

Definition at line 256 of file LCD_44780_I2C.c.

References LCD_send_command().

void LCD_cursor ( unsigned char  active,
unsigned char  blinking 
)

This function controls the cursor option (blinking, active)

Parameters
activeActivate the cursor, showing it or not [LCD_TURN_ON_CURSOR, LCD_TURN_OFF_CURSOR]
blinkingLet the cursor blink [LCD_BLINKING_ON, LCD_BLINKING_OFF]
Note
You must use the constant LCD_TURN_ON_CURSOR, LCD_TURN_OFF_CURSOR, LCD_BLINKING_ON, LCD_BLINKING_OFF to ensure the compatibility with LCD_44780_I2C library.

Definition at line 265 of file LCD_44780_I2C.c.

References LCD_send_command().

void LCD_enable_pulse ( 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 55 of file LCD_44780_I2C.c.

References data_buffer, delay_ms(), LCD_E, PCF8574_address, and write_data_PCF8574.

void LCD_goto_line ( 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 Displays. Tested on 20x4 16x2 LCD displays.

Definition at line 121 of file LCD_44780_I2C.c.

References LCD_send_command().

void LCD_goto_xy ( 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 Displays. Tested on 20x4 16x2 LCD displays.

Definition at line 146 of file LCD_44780_I2C.c.

References LCD_goto_line(), LCD_shift_cursor(), and RIGHT.

void LCD_home ( void  )

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

Definition at line 84 of file LCD_44780_I2C.c.

References LCD_send_command().

void LCD_send_command ( unsigned char  data)

This function generates the Enable pulse.

Parameters
dataData to be sent [0..255]
Warning
This function is a Private one. It should not be used by the user.

Definition at line 67 of file LCD_44780_I2C.c.

References data_buffer, LCD_enable_pulse(), PCF8574_address, and write_data_PCF8574.

void LCD_shift ( unsigned char  shift,
unsigned char  number_of_shift 
)

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

Parameters
shiftSpecify where the shift should be [LCD_LEFT, LCD_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 94 of file LCD_44780_I2C.c.

References LCD_send_command().

void LCD_shift_cursor ( unsigned char  shift,
unsigned char  number_of_shift 
)

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

Parameters
shiftSpecify where the shift should be [LCD_LEFT, LCD_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 108 of file LCD_44780_I2C.c.

References LCD_send_command().

void LCD_write_char ( unsigned char  value)

This function writes a char to the LCD display. (e.g LCD_write_char ('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 156 of file LCD_44780_I2C.c.

References data_buffer, LCD_RS, LCD_send_command(), PCF8574_address, and write_data_PCF8574.

void LCD_write_integer ( 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 display.
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 217 of file LCD_44780_I2C.c.

References LCD_write_string().

void LCD_write_message ( const rom unsigned char *  buffer)

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

Definition at line 181 of file LCD_44780_I2C.c.

References LCD_write_char(), and LCD_write_message().

void LCD_write_string ( 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 LCD_write_message ().

Definition at line 201 of file LCD_44780_I2C.c.

References LCD_write_char().

Variable Documentation

unsigned char data_buffer = 0

Definition at line 49 of file LCD_44780_I2C.c.

unsigned char PCF8574_address = 0

Definition at line 50 of file LCD_44780_I2C.c.