View Full Version : timing pulses
04-06-2007, 12:12 PM
I'm attempting to make a telegraph that would convert the electrical impulses to a keyboard letter for use through USB. Does the Stamp 2 allow for the timing of input pulses, which is obviously important for morse code?
04-06-2007, 04:12 PM
most likely you are not interested in exact time but would like the make the diffence between long (-) and short (.)
Well you could simply do as follows:
CNT VAR Word ' your loop counter (byte might be enough)
INPUT 1 ' make pin 1 an input
CNT = 0 ' init the counter
LOOP: ' wait for input loop
CNT = CNT + 1
IF IN1 = 0 THEN LOOP
SIGNAL: ' you get here whenever the input changes
Now based on the CNT value you can decide if it was a - / .
Do whatever you need to do
Return to the LOOP to capture next input