PDA

View Full Version : Command execution time



barkerben
- 1st December 2004, 23:00
I really must stop posting ....


Is there any reference that shows how long each command takes to execute in PICBasic for a given clock speed?

I have a main loop that does nothing bit set pins and evaluate IF THEN statements while waiting for interrupts, so ideally they should all be serviced very quickly, but wheras in assembler its easy to find out (hard to write) in Basic it seems the reverse. Any thoughts?


Ben

mister_e
- 1st December 2004, 23:07
for a 4MHZ clock, most command will be executed in *about* 4us but can be tested/measure easilly in a loop.

loop:
High OneUnusedPin

' code here

Low OneUnusedPin

goto loop

place a scope/frequency meter on OneUnusedPin and now you have a good idea of the execution time.

regards

Darrel Taylor
- 7th December 2004, 21:29
Hi barkerben,

You can also time the instructions using Timer1.

For an example of how to... See this thread.

http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=365

HTH,
Darrel