Since it's your first post...
Code:
Include "modedefs.bas" ' Include serial modes
TRISA = %00000000 ' All the PORTA pins to outputs.
TRISB = %11111111 ' All the PORTB pins to inputs.
I con 254 '254h = 1111 1110 (Sets LCD to command mode)
ClrScr con 1 '01h = 0000 00001 (Clears Screen & goes to position 1)
Line2 con $C0 'COh = 1100 0000B (sets address to positionn 40 on LCD)
DispCur con 12 '12h = 0000 1100 (activates display & cursor mode)
'Commands obtained from LCD article in epemag.com
pause 400 ' Allow LCD to boot up
Start:
serout PORTA.1,T9600,[I,clrscr]
pause 100
Serout PORTA.1,T9600,["Press Button"]
while PORTB.2=0
' Wait untill push-button is pressed
wend
serout PORTA.1,T9600,[I,clrscr]
pause 100
SEROUT PORTA.1,T9600,["Button Pressed!"] ' Indicate Button Pressed
pause 1000 ' delay 1 sec
goto start
BUT more than often PORTA contain some analog stuff... SEROUT may work properly or not. Look for CMCON or ADCON1 to see how to disable them
Your Define BUTTON will not do anything if you don't use BUTTON command.
Bookmarks