It sounds like you only want to send a character on the state change of the switch. Use a bit variable such as current_state for the last known state.Originally Posted by mister_e
This way, you won't hang the program up waiting for the switch to change.
Read_switch:
if (PORTA.1= current_state) then goto main ; No change goto main program
hserout [PORTA.1 + $30] ; Make the switch value the ASCII equivelent and send it.
current_state = PORTA.1 ; Current_state = switch value
goto main ; How neat is that?!?
Bookmarks