lcd.h File Reference

Library to control LCD over I²c. More...

#include "asuro.h"

Go to the source code of this file.

Defines

#define LCD_INIT   {(LCD_4BIT | LCD_2LINE | LCD_5X7), 0}
#define LCD_DEV   0x40
#define LCD_LINES   2
#define LCD_CHARS   8
#define LCD_LINE1   0x00
#define LCD_LINE2   0x40
#define LCD_LINE3   0x10
#define LCD_LINE4   0x50
#define LD4   0
#define LD5   1
#define LD6   2
#define LD7   3
#define LRS   4
#define LRW   5
#define LEN   7
#define LBL   6
#define LCD_D0   (1 << LD4)
#define LCD_D1   (1 << LD5)
#define LCD_D2   (1 << LD6)
#define LCD_D3   (1 << LD7)
#define LCD_D4   (1 << LD4)
#define LCD_D5   (1 << LD5)
#define LCD_D6   (1 << LD6)
#define LCD_D7   (1 << LD7)
#define LCD_RS   (1 << LRS)
#define LCD_RW   (1 << LRW)
#define LCD_EN   (1 << LEN)
#define LCD_BL   (1 << LBL)
#define LCD_CLEAR   0x01
#define LCD_HOME   0x02
#define LCD_ENTRYMODE   0x04
#define LCD_INCREASE   (LCD_ENTRYMODE | 0x02)
#define LCD_DECREASE   (LCD_ENTRYMODE | 0x00)
#define LCD_DISPLAYSHIFTON   (LCD_ENTRYMODE | 0x01)
#define LCD_DISPLAYSHIFTOFF   (LCD_ENTRYMODE | 0x00)
#define LCD_DISPLAYMODE   0x08
#define LCD_DISPLAYON   (LCD_DISPLAYMODE | 0x04)
#define LCD_DISPLAYOFF   (LCD_DISPLAYMODE | 0x00)
#define LCD_CURSORON   (LCD_DISPLAYMODE | 0x02)
#define LCD_CURSOROFF   (LCD_DISPLAYMODE | 0x00)
#define LCD_BLINKINGON   (LCD_DISPLAYMODE | 0x01)
#define LCD_BLINKINGOFF   (LCD_DISPLAYMODE | 0x00)
#define LCD_SHIFTMODE   0x10
#define LCD_DISPLAYSHIFT   (LCD_SHIFTMODE | 0x08)
#define LCD_CURSORMOVE   (LCD_SHIFTMODE | 0x00)
#define LCD_RIGHT   (LCD_SHIFTMODE | 0x04)
#define LCD_LEFT   (LCD_SHIFTMODE | 0x00)
#define LCD_CONFIGURATION   0x20
#define LCD_8BIT   (LCD_CONFIGURATION | 0x10)
#define LCD_4BIT   (LCD_CONFIGURATION | 0x00)
#define LCD_2LINE   (LCD_CONFIGURATION | 0x08)
#define LCD_1LINE   (LCD_CONFIGURATION | 0x00)
#define LCD_5X10   (LCD_CONFIGURATION | 0x04)
#define LCD_5X7   (LCD_CONFIGURATION | 0x00)
#define LCD_CGRAM   0x40
#define LCD_DDRAM   0x80

Functions

void InitLCD (void)
 Init LCD Hardware.
void BacklightLCD (unsigned char state)
 Switch LCD Backlight on/off.
void SetIOLCD (unsigned char setCommand, unsigned char bits)
 Set LCD IO Port.
unsigned char GetIOLCD (void)
 Read LCD IO Port.
void SetCursorLCD (unsigned char cursor, unsigned char line)
 Set Cursor.
void ClearLCD (void)
 Clears the Display.
void SetDataLCD (unsigned char data)
 Write Data LCD, for use with CommandLCD or WriteLCD.
void CommandLCD (unsigned char command)
 Set LCD Command, implemented as macro.
void WriteLCD (unsigned char data)
 Write Data.
void PrintLCD (char *string, unsigned char wrap)
 Print String to LCD.
void PrintSetLCD (unsigned char cursor, unsigned char line, char *string)
 Print String at cursor position.
void PrintIntLCD (int value)
 Print Integer Value.
void PrintAlignLCD (unsigned char line, unsigned char alignment, char *string)
 Print a String at aligned position (left, center right).

Variables

unsigned char portLCD
unsigned char lineLCD
unsigned char cursorLCD


Detailed Description

Library to control LCD over I²c.

LCD Library
This Library is designed for HD44870 based LCDs with I2C expander PCF8574p. It requires I²C Master Software from Peter Fleury. PIN-Assignment: P0-P3 -> DB4-DB7, P4 -> RS, P5 -> R/w, P7 -> Enable. For Use with ASURO Robot

Inspiration from I²C-LCD library by "Nico Eichelmann, Thomas Eichelmann"

Definition in file lcd.h.


Define Documentation

#define LBL   6

Definition at line 77 of file lcd.h.

#define LCD_1LINE   (LCD_CONFIGURATION | 0x00)

Definition at line 133 of file lcd.h.

#define LCD_2LINE   (LCD_CONFIGURATION | 0x08)

Definition at line 132 of file lcd.h.

#define LCD_4BIT   (LCD_CONFIGURATION | 0x00)

Definition at line 131 of file lcd.h.

#define LCD_5X10   (LCD_CONFIGURATION | 0x04)

Definition at line 134 of file lcd.h.

#define LCD_5X7   (LCD_CONFIGURATION | 0x00)

Definition at line 135 of file lcd.h.

#define LCD_8BIT   (LCD_CONFIGURATION | 0x10)

Definition at line 130 of file lcd.h.

#define LCD_BL   (1 << LBL)

Definition at line 96 of file lcd.h.

#define LCD_BLINKINGOFF   (LCD_DISPLAYMODE | 0x00)

Definition at line 121 of file lcd.h.

#define LCD_BLINKINGON   (LCD_DISPLAYMODE | 0x01)

Definition at line 120 of file lcd.h.

#define LCD_CGRAM   0x40

Definition at line 137 of file lcd.h.

#define LCD_CHARS   8

Definition at line 60 of file lcd.h.

#define LCD_CLEAR   0x01

Definition at line 106 of file lcd.h.

#define LCD_CONFIGURATION   0x20

Definition at line 129 of file lcd.h.

#define LCD_CURSORMOVE   (LCD_SHIFTMODE | 0x00)

Definition at line 125 of file lcd.h.

#define LCD_CURSOROFF   (LCD_DISPLAYMODE | 0x00)

Definition at line 119 of file lcd.h.

#define LCD_CURSORON   (LCD_DISPLAYMODE | 0x02)

Definition at line 118 of file lcd.h.

#define LCD_D0   (1 << LD4)

Definition at line 83 of file lcd.h.

#define LCD_D1   (1 << LD5)

Definition at line 84 of file lcd.h.

#define LCD_D2   (1 << LD6)

Definition at line 85 of file lcd.h.

#define LCD_D3   (1 << LD7)

Definition at line 86 of file lcd.h.

#define LCD_D4   (1 << LD4)

Definition at line 88 of file lcd.h.

#define LCD_D5   (1 << LD5)

Definition at line 89 of file lcd.h.

#define LCD_D6   (1 << LD6)

Definition at line 90 of file lcd.h.

#define LCD_D7   (1 << LD7)

Definition at line 91 of file lcd.h.

#define LCD_DDRAM   0x80

Definition at line 138 of file lcd.h.

#define LCD_DECREASE   (LCD_ENTRYMODE | 0x00)

Definition at line 111 of file lcd.h.

#define LCD_DEV   0x40

Definition at line 58 of file lcd.h.

#define LCD_DISPLAYMODE   0x08

Definition at line 115 of file lcd.h.

#define LCD_DISPLAYOFF   (LCD_DISPLAYMODE | 0x00)

Definition at line 117 of file lcd.h.

#define LCD_DISPLAYON   (LCD_DISPLAYMODE | 0x04)

Definition at line 116 of file lcd.h.

#define LCD_DISPLAYSHIFT   (LCD_SHIFTMODE | 0x08)

Definition at line 124 of file lcd.h.

#define LCD_DISPLAYSHIFTOFF   (LCD_ENTRYMODE | 0x00)

Definition at line 113 of file lcd.h.

#define LCD_DISPLAYSHIFTON   (LCD_ENTRYMODE | 0x01)

Definition at line 112 of file lcd.h.

#define LCD_EN   (1 << LEN)

Definition at line 95 of file lcd.h.

#define LCD_ENTRYMODE   0x04

Definition at line 109 of file lcd.h.

#define LCD_HOME   0x02

Definition at line 107 of file lcd.h.

#define LCD_INCREASE   (LCD_ENTRYMODE | 0x02)

Definition at line 110 of file lcd.h.

#define LCD_INIT   {(LCD_4BIT | LCD_2LINE | LCD_5X7), 0}

Definition at line 55 of file lcd.h.

#define LCD_LEFT   (LCD_SHIFTMODE | 0x00)

Definition at line 127 of file lcd.h.

#define LCD_LINE1   0x00

Definition at line 62 of file lcd.h.

#define LCD_LINE2   0x40

Definition at line 63 of file lcd.h.

#define LCD_LINE3   0x10

Definition at line 64 of file lcd.h.

#define LCD_LINE4   0x50

Definition at line 65 of file lcd.h.

#define LCD_LINES   2

Definition at line 59 of file lcd.h.

#define LCD_RIGHT   (LCD_SHIFTMODE | 0x04)

Definition at line 126 of file lcd.h.

#define LCD_RS   (1 << LRS)

Definition at line 93 of file lcd.h.

#define LCD_RW   (1 << LRW)

Definition at line 94 of file lcd.h.

#define LCD_SHIFTMODE   0x10

Definition at line 123 of file lcd.h.

#define LD4   0

Definition at line 69 of file lcd.h.

#define LD5   1

Definition at line 70 of file lcd.h.

#define LD6   2

Definition at line 71 of file lcd.h.

#define LD7   3

Definition at line 72 of file lcd.h.

#define LEN   7

Definition at line 76 of file lcd.h.

#define LRS   4

Definition at line 74 of file lcd.h.

#define LRW   5

Definition at line 75 of file lcd.h.


Function Documentation

void BacklightLCD ( unsigned char  state  ) 

Switch LCD Backlight on/off.

Parameters:
state On or off

void ClearLCD ( void   ) 

Clears the Display.

Parameters:
none 

void CommandLCD ( unsigned char  command  ) 

Set LCD Command, implemented as macro.

Parameters:
command LCD command

unsigned char GetIOLCD ( void   ) 

Read LCD IO Port.

Returns:
IO Port

void InitLCD ( void   ) 

Init LCD Hardware.

void PrintAlignLCD ( unsigned char  line,
unsigned char  alignment,
char *  string 
)

Print a String at aligned position (left, center right).

Parameters:
line Line number
alignment left, center or right aligned
string string pointer

void PrintIntLCD ( int  value  ) 

Print Integer Value.

Parameters:
value Integer value

void PrintLCD ( char *  string,
unsigned char  wrap 
)

Print String to LCD.

Parameters:
string String pointer
wrap String Wrapped or not

void PrintSetLCD ( unsigned char  cursor,
unsigned char  line,
char *  string 
)

Print String at cursor position.

Parameters:
cursor Cursor position
line line number
string String pointer

void SetCursorLCD ( unsigned char  cursor,
unsigned char  line 
)

Set Cursor.

Parameters:
cursor cursor position
line line number

void SetDataLCD ( unsigned char  data  ) 

Write Data LCD, for use with CommandLCD or WriteLCD.

Parameters:
data LCD Data

void SetIOLCD ( unsigned char  setCommand,
unsigned char  bits 
)

Set LCD IO Port.

Parameters:
setCommand ON or OFF
bits Bits to set

void WriteLCD ( unsigned char  data  ) 

Write Data.

Parameters:
data LCD Data


Variable Documentation

unsigned char cursorLCD

Definition at line 145 of file lcd.h.

unsigned char lineLCD

Definition at line 144 of file lcd.h.

unsigned char portLCD

Definition at line 143 of file lcd.h.


Generated on Sun Nov 18 18:30:58 2007 for ASURO Library by  doxygen 1.5.1-p1