Newb needs speed

#1
Does anyone know roughly the time it takes for any of the basic commands to execute, and on which PICAXE? Any info would be appreciated, but most interested in the 28X and X1 and the 18X. I don;t know if this is a readily documented thing?
 
#2
No list exists as far as I know, and the usual thing people do is:

a) Toggle an output pin before and after the code of interest and measure the pulse width with a scope.

b) put the code of interest in a for/next loop of many iterations (say a few thousand), and time the duration of the for/next using the internal timer (or a scope). You can also take account of the for/next overhead by timing it with and without the code within the loop.

I find it an interesting topic and quite revealing when you get into the nitty-gritty.

Edited by - jeremy leach on 21/08/2007 08:00:20
 
#3
Not a simple answer because it depends on command position and value of variables used.
Most commands will take ABOUT 250uS with a 4Mhz clock. (the 28X1 is a bit quicker).
Some commands can take a lot longer, eg readtemp. Debug is the slowest.

There are countless threads on this topic. Use the search facility.
 
#4
Hippy has tested a 4mhz 18x to do about 2000 statements/sec that was with a simple loop
that should give you a rough idea

some commands take longer than others so it'll depend greatly on your code and how well it is written

stuff we'll need to know, so we can give you the best possible advice

whats the application?
target picaxe?
proposed operating voltage?
type/size of power supply?
does anything,and what needs to be turned on/off/flashed?
is this going to be used for any type of diy weapon?
have you read the picaxe manuals?
in several word please give us a rough idea of experience with the picaxe

Edited by - demonicpicaxeguy on 21/08/2007 08:19:00
 

hippy

Technical Support
Staff member
#5
This is definitely a case for persevering with the Forum Search function ( top right of page ) as there has been a lot of discussion on this issue, various analysis done in the past and explanations given.

Instruction timing should be broadly similar for each PICAXE but there will be some differences because they each have different firmware. If GOTO were 'Opcode Value 1' internally on one PICAXE and 'Opcode Value 199' on another, the second would take slightly longer because it takes time to handle larger numbers.
 
#6
it would depend on how the firmware has been written, with my interpreter it takes a MAX of 8 if statements (asm equilivant) to actaully sort out the opcodes and that allows the option of 256 different instructions to interpret
 
Top