Dim menucode As Byte
Dim gait As Byte
Dim speed As Byte
Dim mode As Byte
OPTION_REG = 0x30 'tmr0, ext clock,high to low,
INTCON.TMR0IE = 1 'set tmr0 interrupt
INTCON.TMR0IF = 0 'clear an existing tmro flag
TMR0 = 0xff 'load timer0 with 255, intr on next high to low
startup:
Lcdinit LcdCurBlink
Lcdcmdout LcdClear
gait = 0
speed = 0
mode = 0
Enable 'enable interrupts
'for my use only
Serout PORTA.2, 4800, "OK", CrLf 'for serial tx test only
start:
Select Case menucode
Case 1
Gosub mainmenu
Case 2
Gosub runmenu
Case 3
Gosub setupmenu
EndSelect
menucode = 0
Goto start
End
''''''''''''''''''''''''''''''''''''''
'you may want to add save system
On Interrupt
getdata:
INTCON.TMR0IF = 0 'clear inter flag
Serin PORTA.4, 4800, menucode, gait, speed, mode
TMR0 = 0xff 'reload tmr0 with 255
Resume
'''''''''''''''''''''''''''''''''''''''''''''