Keyboard interrupt
Stampmyster
Posts: 27
Im aware that a button can be used to allow a program to branch in real-time, as an assigned-pin can be monitored to see it the button was pressed or not, all the while the program continues to run.
-The program is not stopped waiting for input, like when using DEBUGIN command.-
Is there a way to monitor the keyboard to do the same? For instance, in the debug window have it read; To flash blue light hit any key, all the while the program continues to run until a key is pressed. It will then branch to the flash-blue-light routine without pausing the program first.
Perhaps there is a way to read the keyboard buffer itself? Or use a null?
For some reason, I think I have seen it before somewhere, and may be fundamental?
Thanks!
-The program is not stopped waiting for input, like when using DEBUGIN command.-
Is there a way to monitor the keyboard to do the same? For instance, in the debug window have it read; To flash blue light hit any key, all the while the program continues to run until a key is pressed. It will then branch to the flash-blue-light routine without pausing the program first.
Perhaps there is a way to read the keyboard buffer itself? Or use a null?
For some reason, I think I have seen it before somewhere, and may be fundamental?
Thanks!
Comments
It's possible to add an external serial interface. I think Microchip makes one (MAX3400?). That would let you do what you're describing.
I did investigate the SERIN command and actually thought about using the timeout parameter. I will try again. (I never used the timeout before and unfamiliar.)
I will also look into the Microchip max3400...
Thank you kindly!
I want the option to access my EEPROM manually on start-up. If there is a reset, and no one is around, it will still restart normally, and not wait indefinitely.
If I hit any key during the waiting period, it will branch to a new program.
If I decide to do nothing, the Main-Program simply continues after a few seconds:
I created an example, for others if they might find it useful.
' {$STAMP BS2}
' {$PBASIC 2.0}
This program allows a user a few seconds to decide (whether or not) to branch off to a
sub-routine, and if nothing is entered it simply continues with the Main-Program.
result VAR Word
begin:
DEBUG CLS, "You have three secs to hit any key to access EEPROM.", CR
SERIN 16, 16468, 3000, No_Data, [result]
DEBUG " = ", DEC result
DEBUG CR, CR, "You have now paused the Main_Program,", CR
DEBUG "and entered the EEPROM_Access_Tool."
END
No_Data:
DEBUG CR, "You have decided not pause the Main_Program,"
DEBUG CR, "and Main_Program will now continue."
PAUSE 5000 : GOTO begin
Thanks Mr. Green!