lbenson
Senior Member
Perhaps this has been noted before, but I missed it. I've been scratching my head as to why the "time" count that I've been using in a program for rough timing is so far off. As it turns out, the counting of "time" is disabled during a READTEMP command (up to 750ms), so if you are doing READTEMP in a tight loop, the time spent in READTEMP far exceeds the remainder of the loop time during which the counter for "time" is incremented. This program illustrates the point.
If the READTEMP line is commented out, the SERTXD command give a pretty good 1,2,3, etc. count of seconds. With READTEMP in, over 30 seconds elapse between the printing of "1" and "2", and other counts.
In my real program, there is no good reason to read the temperature with every loop iteration.
Code:
#picaxe 08M2
#no_data
main:
do
if time <> w12 then
sertxd(#time," ")
w12 = time
endif
readtemp b.1,b1
loop
In my real program, there is no good reason to read the temperature with every loop iteration.