lcd.h File Reference

LCD routines. More...

#include "config.h"
#include "pic_utils.h"
Include dependency graph for lcd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define __lcd_h   include
#define LCD_CLEAR_DISP   0b00000001
#define lcd_clear_display()   lcd_write_command(LCD_CLEAR_DISP);
 Clear LCD display.
#define LCD_LINE1   0b10000000
#define LCD_LINE2   0b11000000
#define LCD_LINE3   0b10010100
#define LCD_LINE4   0b11010100
#define lcd_return_home()   lcd_write_command(LCD_RETURN_HOME);
 Return cursor home.
#define LCD_RETURN_HOME   0b00000010
#define LCD_SET_DRAM_ADDR   0b10000000

Functions

void lcd_init ()
 Initialise LCD ready for display.
void lcd_setup ()
 Setup port and pins to talk to LCD.
void lcd_wait_busy ()
 Wait while LCD is busy.
void lcd_write_command (uns8 data)
 Sends a command to the LCD.
void lcd_write_data (uns8 data)
 Send one byte of data to the LCD.
void lcd_write_data_int (uns16 i)
 Print a 16 bit integer the the LCD.
void lcd_write_data_str (char *str)
 Print a string to the LCD.

Detailed Description

This module contains routines to communicate with an LCD via the 4 bit parallel mode. All pins are protected from read-before-write problems with picpack's port latch simulation. Reads ready flag to check LCD isn't busy before sending more data.

Definition in file lcd.h.


Define Documentation

#define __lcd_h   include

Definition at line 47 of file lcd.h.

#define LCD_CLEAR_DISP   0b00000001

Clear LCD display

Definition at line 77 of file lcd.h.

Referenced by lcd_cursor_home(), and lcd_init().

 
#define lcd_clear_display (  )     lcd_write_command(LCD_CLEAR_DISP);

Definition at line 140 of file lcd.h.

#define LCD_LINE1   0b10000000

Move cursor to line 1

Definition at line 83 of file lcd.h.

#define LCD_LINE2   0b11000000

Move cursor to line 2

Definition at line 85 of file lcd.h.

#define LCD_LINE3   0b10010100

Move cursor to line 3

Definition at line 87 of file lcd.h.

#define LCD_LINE4   0b11010100

Move cursor to line 4

Definition at line 89 of file lcd.h.

 
#define lcd_return_home (  )     lcd_write_command(LCD_RETURN_HOME);

Definition at line 142 of file lcd.h.

#define LCD_RETURN_HOME   0b00000010

Move cursor to top left position

Definition at line 79 of file lcd.h.

Referenced by lcd_init().

#define LCD_SET_DRAM_ADDR   0b10000000

Move to DRAM address (cursor position)

Definition at line 81 of file lcd.h.


Function Documentation

void lcd_init (  ) 

Configures LCD for 4 bit operation and gets ready for displaying text

Definition at line 84 of file lcd.c.

References LCD_CLEAR_DISP, LCD_RETURN_HOME, lcd_toggle_e(), lcd_write_command(), and lcd_write_nibble().

Here is the call graph for this function:

void lcd_setup (  ) 

Call this routine first, to set up tris bits correctly to talk to the LCD

Definition at line 67 of file lcd.c.

References clear_pin, and make_output.

void lcd_wait_busy (  ) 

Internal routine to wait while the LCD is busy and unable to accept more data

Definition at line 154 of file lcd.c.

References clear_pin, set_pin, and test_pin.

Referenced by lcd_write_command(), lcd_write_data(), and lcd_write_data_str().

Here is the caller graph for this function:

void lcd_write_command ( uns8  data  ) 

Use this to send commands to the LCD, eg, changing cursor position

Definition at line 113 of file lcd.c.

References clear_pin, lcd_wait_busy(), and lcd_write_byte().

Referenced by lcd_cursor_home(), lcd_init(), lcd_set_cgram_pos(), and lcd_set_ddram_pos().

Here is the call graph for this function:

Here is the caller graph for this function:

void lcd_write_data ( uns8  data  ) 

Definition at line 123 of file lcd.c.

References clear_pin, lcd_wait_busy(), lcd_write_byte(), and set_pin.

Here is the call graph for this function:

void lcd_write_data_int ( uns16  i  ) 

Displays an unsigned 16 bit integer on the LCD

Definition at line 145 of file lcd.c.

References lcd_write_data_str().

Here is the call graph for this function:

void lcd_write_data_str ( char *  str  ) 

Display the string on the LCD from the current cursor position

Definition at line 132 of file lcd.c.

References clear_pin, lcd_wait_busy(), lcd_write_byte(), and set_pin.

Referenced by lcd_write_data_int().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Wed Dec 8 13:47:23 2010 for Pic Pack by  doxygen 1.6.1