I wrote some code to generate test signals, using the 'rule of thumb' 250uS per op - but it ran much slower than I expected.
Breaking the code down to understand the bottleneck, I found that an 'empty' FOR/NEXT loop takes 1.6mS!
Are there any techniques to 'loop' faster than this?
Switched to 32Mhz, and it comes down to 0.2mS of course - but that's not the issue.
I searched on 'loop speed' and got 500 threads. I know there's lots of good information in this forum, but the search feature is off little value IMO.
Breaking the code down to understand the bottleneck, I found that an 'empty' FOR/NEXT loop takes 1.6mS!
Are there any techniques to 'loop' faster than this?
Switched to 32Mhz, and it comes down to 0.2mS of course - but that's not the issue.
Code:
#picaxe 20M2
#no_data
SetFreq m32
Main:
Do
For b0 = 0 to 23
'Stuff commented out for this test.
Next b0
Toggle B.7 ' Sync Pulse
Loop 'Loops about 40mS @ 4Mhz, 5mS @ 32Mhz