User manual

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)
########################################################################
#
# BIG CLOCK & 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])
def ShowBigDigit(symbol,startCol):
#displays a 4-row-high digit at specified column
for row in range(4):
GotoXY(row,startCol)
for col in range(3):
index = row*3 + col
SendByte(symbol[index],True)
def ShowColon(col):
#displays a 2-char high colon ':' at specified column
dot = chr(0xA1)
GotoXY(1,col)
SendChar(dot)
GotoXY(2,col)
SendChar(dot)
def BigClock(seconds=10):
#displays large-digit time in hh:mm:ss on 20x4 LCD
#continuous display (this routine does not end!)
print " Big Clock running"