Let's Make Robots!

Actual speed of a PICAXE

Does anybody now how many clock cycles it takes for an instruction to be executed by a picaxe? Does it vary depending on the type of instruction?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hey check this out: http://www.rev-ed.co.uk/docs/AXE001_bas2ass.pdf 

This basically converts your basic program into assembler and then uploads it to a blank pic via a programmer. I believe there is difference between using the standard picaxe programming editor and this, but i'm not sure about it. Would it make it faster somehow? 

The microcontroller itself operates at Fosc/4. Your program language may use several instruction cycles to do one of its cycles, but the MIPS of the actual PIC is still Fosc/4.
Ok...so it appears that the slow speed of the picaxe is related to the language i'm using, or kind of... thanks!

 

How fast does the PICAXE operate?
Can I overclock the PICAXE?
The PICAXE-08/18/18A/18M/18X microcontrollers have an internal 4MHz
resonator, and the PICAXE-28/40 family use an external 4MHz ceramic resonator.
This means the microcontroller processes 1 million assembler commands a
second, which equates to roughly about 1000 BASIC commands per second.
Different commands take different times to execute depending on how complex
their ‘assembler code’ is.
The M and X parts can be overclocked to 8 or 16MHz (see the Over-clocking
Appendix for restrictions).

Also, the 1uS "per instruction" applies to the frequency the PIC is running at. It is really 4MHZ/4, =1MIPS = 1uS

 So: MHZ/4 =xmips    1 second/xmips= 1 instruction per y seconds. The "y" is going to be very small.

A PIC in C program language can use PLL to increase frequency by 4, thus equalizing the 4 internal divide. 8mhz x4 /4 = 8MIPS. This is what I do with my robots.
Since a PICAXE is a PIC, it takes 4 instruction cycles, so MIPS= Clock freq/4
Thank you. But then i've got another question. I've heard that using an in-chip basic(programming language) interpreter makes the program slower than if you were programming in, for example, assembly. But how can this be true if, as it appears from your answer, speed is only chip-dependant?
That clock speed / 4 works only if you use assembler. If you use some freacky higher level thingy then... it is hard to detect...
Ahh ok got it. But is there a way to obtain higher speeds? For example: why does the PICAXE need to have a basic interpeter? Couldn't you have a program which converts your basic program to something like assembly and THEN transfers it to the chip so that it does not need an on-board interpreter?

That's excactly what the Picaxe editor does :)

However, the code can never be as "clean" as if you write it all straight in assembly.

I really wonder what all those speed issues are about?

Sure, I have space & speed issues all the time, that's what all the fun is about. I program my way out of it. Have you posted the project that is so speedy-needy somewhere tuna? Maby I can help with the code?