Smitty
02-12-2005, 05:44 AM
This code...
MAIN:
DEBUG "."
'check for input
SERIN 16, 240, 15, TIMEOUT, [WAIT("*"), STR cmdIn\2]
'do some stuff
GOTO AFTER_INPUT
TIMEOUT:
'do some stuff
AFTER_INPUT:
'do some stuff
GOTO MAIN
Should run NO FASTER than 66 times per second with no input. There is a 15 ms timeout value... 1000ms / 15 ms = 66.6... and that doesn't even consider the time to execute all of the other instructions in the "Do some stuff" sections...
So when I let it run for 10 seconds, why does it print over 4000 dots in the console? I cut and pasted the output into notepad, saved it as a text file, and checked the file size in bytes... I tried various run times to get a better average... they all show that a dot is printed roughly every .0029 seconds.
How can this loop run in less than 3 ms per iteration when it should take 15 ms just to timeout?
(This could explain some funky timing issues with SERIN...)
MAIN:
DEBUG "."
'check for input
SERIN 16, 240, 15, TIMEOUT, [WAIT("*"), STR cmdIn\2]
'do some stuff
GOTO AFTER_INPUT
TIMEOUT:
'do some stuff
AFTER_INPUT:
'do some stuff
GOTO MAIN
Should run NO FASTER than 66 times per second with no input. There is a 15 ms timeout value... 1000ms / 15 ms = 66.6... and that doesn't even consider the time to execute all of the other instructions in the "Do some stuff" sections...
So when I let it run for 10 seconds, why does it print over 4000 dots in the console? I cut and pasted the output into notepad, saved it as a text file, and checked the file size in bytes... I tried various run times to get a better average... they all show that a dot is printed roughly every .0029 seconds.
How can this loop run in less than 3 ms per iteration when it should take 15 ms just to timeout?
(This could explain some funky timing issues with SERIN...)