Hi,
For a current project, I needed to know the approximate time delays between a sequence of READADCs. Of course I could have put in some marker pulses and used a 'scope, but it seemed easier to read the Timer 1 High byte (which increments every 256us) and store the values in (indirect) RAM. However, the results contained a suspiciously high number of zeros, so I stripped the code down to the absolute basics as follows (typical results are included at the end of the listing) :
It appears that the INC is being executed twice (the zeros are not written they are just the result of initialisation), but I can't see any obvious reason for this. I've only tested the above with a 14M2 and PE5 (5.5.6) and PE6 (6.0.7.1). Am I doing something wrong, or is this a known "feature" (I can't see anything in the Revision History)? Or is it (hopefully) a PE issue?
Thanks, Alan.
For a current project, I needed to know the approximate time delays between a sequence of READADCs. Of course I could have put in some marker pulses and used a 'scope, but it seemed easier to read the Timer 1 High byte (which increments every 256us) and store the values in (indirect) RAM. However, the results contained a suspiciously high number of zeros, so I stripped the code down to the absolute basics as follows (typical results are included at the end of the listing) :
Rich (BB code):
; peeksfr+@bptrinc bug?
; Allycat May 2015
#terminal 4800
#picaxe 14M2
#no_data
symbol TMR1H = $17 ; Timer 1 High byte
main:
pause 100
do
bptr = 30 ; Pointer to test times
; pokesfr TMR1H,0 ; Test option
peeksfr TMR1H,@bptrinc
peeksfr TMR1H,@bptrinc
pause 1
peeksfr TMR1H,@bptrinc
peeksfr TMR1H,@bptrinc
peeksfr TMR1H,@bptr
sertxd(cr,lf,"t=")
for bptr = 30 to 39
sertxd(#@bptr," ")
next
sleep 2
loop
#rem Typical Output:
t=0 184 0 187 0 195 0 197 200 0
t=0 227 0 230 0 237 0 240 242 0
t=0 191 0 194 0 202 0 204 207 0
t=0 227 0 230 0 237 0 240 242 0
#endrem
Thanks, Alan.
Last edited: