User manual

SendByte(CURSOROFF)
def CursorBlink():
SendByte(CURSORBLINK)
def CursorLeft():
SendByte(CURSORLEFT)
def CursorRight():
SendByte(CURSORRIGHT)
def InitLCD():
#initialize the LCD controller & clear display
SendByte(0x33) #initialize
SendByte(0x32) #initialize/4-bit
SendByte(0x28) #4-bit, 2 lines, 5x8 font
SendByte(LEFTTORIGHT) #rightward moving cursor
CursorOff()
ClearDisplay()
def SendChar(ch):
SendByte(ord(ch),True)
def ShowMessage(string):
#Send string of characters to display at current cursor position
for character in string:
SendChar(character)
def GotoLine(row):
#Moves cursor to the given row
#Expects row values 0-1 for 16x2 display; 0-3 for 20x4 display
addr = LINE[row]
SendByte(SETCURSOR+addr)
def GotoXY(row,col):
#Moves cursor to the given row & column
#Expects col values 0-19 and row values 0-3 for a 20x4 display
addr = LINE[row] + col
SendByte(SETCURSOR + addr)
########################################################################
#
# Custom character generation routines
#
def LoadCustomSymbol(addr,data):
#saves custom character data at given char-gen address
#data is a list of 8 bytes that specify the 5x8 character
#each byte contains 5 column bits (b5,b4,..b0)
#each byte corresponds to a horizontal row of the character
#possible address values are 0-7
cmd = LOADSYMBOL + (addr<<3)
SendByte(cmd)
for byte in data:
SendByte(byte,True)
def LoadSymbolBlock(data):
#loads a list of symbols into the chargen RAM, starting at addr 0x00
for i in range(len(data)):
LoadCustomSymbol(i,data[i])