speed of Picaxe chips

Guys I am using a 28x1 @ 4 mhz.
The program runs well, but i would expect it to run faster. Is there a table of average times it takes to execute commands?
As an example; Do commands involving Scratchpad & Table take longer than Ram?

I realise it is a "how long is a piece of string question", but will ask anyway.

Summertown
 

srnet

Senior Member
Guys I am using a 28x1 @ 4 mhz.
The program runs well, but i would expect it to run faster.
It can run faster, though I am not sure why you would 'expect' it to.

Manual 2 page 221 says the 28X1 will run at 8 mhz on the internal oscillator or 20 mhz if you add the external resonator.
 
The program is in three large subroutines, Two of these run quickly enough. The third uses a lot of Table & Scratchpad operations and runs about the same time on the Picaxe and the simulator.
I would have thought the simulator would be a lot slower than the picaxe running on its own???

I have 16mhz resonators at hand and will insert one in the future. I am aware from programming larger micros that there is sometimes a difference in processing times between commands and am curious if that is the same for Picaxe chips.
 

nick12ab

Senior Member
The program is in three large subroutines, Two of these run quickly enough. The third uses a lot of Table & Scratchpad operations and runs about the same time on the Picaxe and the simulator.
Have you got any debug commands in your code - those will severely reduce speed.

Can you post your code?
 
When I was comparing the relative speeds there were no Debug commands.
I don't want to post the code as 2/3 works well, and the core question still remains: Is there an estimate of how long various commands typically take. Even as a ratio to a benchmark, as against absolute time in seconds.
The reason is I can rewrite the program to avoid using commands related to "Table & Scratchpad" if these commands (or others) come with increased processing time.
This will also involve re-writing the software of two related programs, a huge amount of work. However it liike like this is the only option.
 

womai

Senior Member
Rough rule of thumb: Non-X2 Picaxes approx. 2000 commands per sec at 4 MHz. X2 Picaxes approx. 3000 command per sec at 8 MHz. This of course only applies to command who don't e.g. wait for some event (pulsin for example) of have to do a lot of processing (e.g. serout of a long byte sequence).
 

Janne

Senior Member
If you have a digital storage scope, or logic analyzer you could easily build a test hardware.. First make a program that turns an output on and off. Measure the time it takes. Then put the command in question in between the output toggling commands, and you will see the specific time it takes to execute the command. (Small errors apply, as the timing of a command partially depends on it's location inside the program code).
 

Buzby

Senior Member
I would have thought the simulator would be a lot slower than the picaxe running on its own???
So would we, that's why it would be best for you to post the 'slow' subroutine so we can have a look what's going on.

The simulator runs at about 50 instructions per second, the PICAXE 28X1 4MHz runs at about 1000 instructions per second, so the chip should be at least 20 times faster than the PC.

Without a lot more to go on we really are in crystal ball and tea leaf territory.
 

hippy

Ex-Staff (retired)
The rule of thumb timing I use is 250us per simple command at 4MHz, more complicated commands take longer. There shouldn't be any significant overhead to commands using Table or Scratchpad compared to using normal variables.
 
Last edited:
Hi Guys,
Thanks for the assistance. Comments

Womai, Buzby & Hippy.
The rules of thumb you have provided me are exactly what I am after, especially the comment re Scratchpad commands.

Janne
I do have a non storage, Tektronix 300mHz scope. I was about to do as you suggested and look at the actual timings.

Looking at these comments it looks like something is slowing this down significantly. Off to the shed with the scope, and a beer.
Will come back with findings.
Summertown
 
Top