Put yours subrouteenes at the end of your code, never at the beginning!
Modify your If then in the following manner:
if maindisp = 1 then
write 0 , sethighp
pause 10
write 1 , sethighp
mode = 1
maindisp = 0 ' reset flag
endif
Otherwise it will write at every cycle and in this case you do not need the " IF Then " statement. Set your flag to 1 when writing is needed
Yours code for reading key:
getkey:
pause 50
keyin = portc
return
You read the status of the all 8 inputs, than you need to decode to find which key has been pressed.
More:
Are you pulling up your inputs using normally closed switches? otherwise with this code you have to pull down your inputs.
Al.
Bookmarks