JonnyMac
11-10-2010, 03:11 PM
I have a simple PASM subroutine:
' ---------------------
' Pause in microseconds
' ---------------------
'
pauseus mov ustimer, cnt ' sync with system clock
tjz usecs, #pauseus_ret ' bail if zero
sub ustimer, #24 ' account for setup/call/return
add ustimer, ustix ' set timer for 1us
usloop waitcnt ustimer, ustix ' wait and reload
djnz usecs, #usloop ' update delay count
pauseus_ret ret
... and was just looking for a logic check on subtracting 24 from the initial ticks count to take care of call setup and return cycles. Am I on track? Now I'm thinking it should be 28 to account for DJNZ when it doesn't jump.
' ---------------------
' Pause in microseconds
' ---------------------
'
pauseus mov ustimer, cnt ' sync with system clock
tjz usecs, #pauseus_ret ' bail if zero
sub ustimer, #24 ' account for setup/call/return
add ustimer, ustix ' set timer for 1us
usloop waitcnt ustimer, ustix ' wait and reload
djnz usecs, #usloop ' update delay count
pauseus_ret ret
... and was just looking for a logic check on subtracting 24 from the initial ticks count to take care of call setup and return cycles. Am I on track? Now I'm thinking it should be 28 to account for DJNZ when it doesn't jump.