Code Snippits

 

Button Code

Insert the following code to create a button that doesn't autorepeat and is active low


B_Pin CON 14
BtnWrk VAR BYTE
BUTTON B_Pin, 0, 255, 255, BtnWrk, 1, GetFreq

 

LCD Code

Add the code below to your source code and call the InitLCD function before you write anything to the LCD.  (only bs2p)


' { LCD Constants }
DoNothing CON 0
ClearDisplay CON 1
WakeUp CON 48
FourBitMode CON 32
TwoLine5x8Font CON 40
DisplayOff CON 8
DisplayOn CON 12
IncCursor CON 6

InitLCD:
LCDCMD 1, WakeUp
PAUSE 10
LCDCMD 1, WakeUp
PAUSE 1
LCDCMD 1, WakeUp
LCDCMD 1, FourBitMode
LCDCMD 1, TwoLine5x8Font
LCDCMD 1, DisplayOff
LCDCMD 1, DisplayOn
LCDCMD 1, IncCUrsOr   'Set to auto increment the cursor
LCDCMD 1, ClearDisplay
RETURN