I determined it was 48 cycles by using this procedure ...
instruction execution time
http://www.picbasic.co.uk/forum/showthread.php?t=365
I've double checked, and it's definately 48. Although my hardware is different, 18F452 @ 20Mhz, it shouldn't make that much difference.
For your test routine I get these results:
Code:
Value = 20000
Start: ' Cycles uS@20mhz
PORTD.0 = 1 ' 1 .2
Delay = Value /*$004D ' 48 9.6
PORTD.0 = 0 ' 1 .2
PauseUs 700 ' 3501 700.2
Goto Start ' 2 .4
----- -----
' Loop Total 3553 710.6
And, this I didn't expect. Here's the results from Ingvar's first example
Code:
' Cycles uS@20mhz
Dummy1 = OldPulseTime >> 2 ' 31 6.2
Delay = Dummy1 >> 2 ' 31 6.2
Delay = Delay + Dummy1 ' 4 .8
----- -----
' Total 66 13.2
But, his second one looks pretty quick. As long as .3125 is close enough.
Code:
' Cycles uS@20mhz
Dummy1 = OldPulseTime >> 1 ' 5 1.0
Dummy1 = Dummy1 >> 1 ' 3 .6
Delay = Dummy1 >> 1 ' 5 1.0
Delay = Delay >> 1 ' 3 .6
Delay = Delay + Dummy1 ' 4 .8
----- -----
' Total 20 4.0
Bookmarks