Are Rev-Ed & Picaxe missing out??

tmfkam

Senior Member
Just had a prototype board delivered with a PicoMite (well, once I've flashed it...) to assess. Looks interesting if the execution speed of the "code" is fast enough.
With the PicoMite running at it's default (125MHz) and a PIC16F1829 (base device for the 20M2) running at 32MHz I programmed as near identical code as I could to output a binary count onto four LEDs on both devices. Having got it working on both I hooked both outputs to the 'scope. Lowest bit output switched at 860Hz on the PicoMite and at 30,000Hz on the PIC. The PIC was running a truly compiled ".asm" program (compiled from BASIC) though I had hoped for something faster from the PicoMite.

As the PIC language had slightly less instructions in its program (offering direct access to the bits in a byte) I added twice as many commands per bit retrieval into the PIC program to compensate, that slowed it from 31,000 down to 30,000Hz.

I should point out there is an IDE for MMBasic. MMEdit. This allows entry of programs on a PC which are then downloaded to the target device in a similar way to PE5 or PE6. There is also a DOS based simulator for code.

Pity it isn't quicker though.

Code:
SetPin GP0, DOut
SetPin GP1, DOut
SetPin GP2, DOut
SetPin GP3, DOut
SetPin GP6, DOut
SetPin GP7, DOut
SetPin GP8, DOut
SetPin GP9, DOut
Dim MyMaster   As Integer
Dim MyCounter1 As Integer
Dim MyCounter2 As Integer
Dim MyCounter3 As Integer
Dim MyCounter4 As Integer
Let MyCounter1 = 0
Let MyCounter2 = 0
Let MyCounter3 = 0
Let MyCounter4 = 0

Do
 
  Pin(GP0) = MyCounter1
  Pin(GP1) = MyCounter2
  Pin(GP2) = MyCounter3
  Pin(GP3) = MyCounter4
  Pin(GP6) = MyCounter1
  Pin(GP7) = MyCounter2
  Pin(GP8) = MyCounter3
  Pin(GP9) = MyCounter4
 
  'Pause 100 'mS Pause can accept 0.1 (equivalent to 100 uS)
  Let MyMaster = MyMaster + 1
 
  Let MyCounter1 = MyMaster
  Let MyCounter1 = MyCounter1 And 1
 
  Let MyCounter2 = MyMaster   >> 2
  Let MyCounter2 = MyCounter2 And 1
 
  Let MyCounter3 = MyMaster   >> 3
  Let MyCounter3 = MyCounter3 And 1
 
  Let MyCounter4 = MyMaster   >> 4
  Let MyCounter4 = MyCounter4 And 1
 
  If MyMaster > 31 Then
    Let MyMaster = 0
  End If
Loop
 
Last edited:

Bill.b

Senior Member
I use picaxe exclusively for motor control of my robot cars and Christmas displays. I also use a large amount of WS2812 LED strips and matrix displays. Picaxe are not suitable for the WS2812, I use a combination of PIC32MX170s and pico to drive the LEDs, MMbasic has a one line command for WS2812s. and it handles the 2K size arrays to address up to 256 WS2812s matrix ( 8 * 32) with scrolling messages.
 

steliosm

Senior Member
@tmfkam I saw the MMEdit IDE for mmbasic but it didn't look quite as advaced as the Picaxe one. Also, do you programmed the Pic chip using GCB?

@Bill.b ws2812 it's almost impossible to do on the picaxe due to speed and memory limitations. APA102 with data and clock pin is doable. I have been using an 8051 ic (STC15W) to handle the neopixels strips. Works fine, ws2812 seems to be very forgiving for the timing , although I really need to dive deep and fine tune the timings.
 

oracacle

Senior Member
That is only in that application, what happens when you need to start doing something more complex, like floating point maths, or multiline if statements? How about an output in response to an input
eg
Code:
if inputA = 1 then
  toggle outputA
endif
then measure the time between the input and the output toggling
 

Bill.b

Senior Member
@tmfkam I saw the MMEdit IDE for mmbasic but it didn't look quite as advaced as the Picaxe one. Also, do you programmed the Pic chip using GCB?
the pic32MX have the mmbasic firmware loaded and I use MMEdit to download programs via a USB to serial converter.
Also MMEdit will download programs directly to the pico modules via the USB port

Bill
 

tmfkam

Senior Member
@tmfkam I saw the MMEdit IDE for mmbasic but it didn't look quite as advaced as the Picaxe one. Also, do you programmed the Pic chip using GCB?
You are correct, the editor isn't as advanced, but it has a lot of similarities. The downloads and programming can all be done from within the editor. It is a community project and not a commercial one so should be judged on that basis.

I used a "Compiled BASIC" yes.
 
Last edited:

tmfkam

Senior Member
As of not having much to do at work...

I reflashed the Pico with Micro Python and wrote the same program (or as near as) in Python (yuk, yuk and double yuk!) then sent it to the Pico.

The Pico toggled the lowest bit output at just under 3,000Hz with the PIC at 30,000. So Python seemed to be three times faster than when running MMBasic but still ten times slower.

I had hoped for greater operational speed than that. I know that MMBasic has built in commands for many of the peripherals (SPI, Ic2, the WS2812 and so on) which I understand operate at or near to native speed but in my work I don't need those, amongst other things, I need to decode bit sequences for a display, re-arrange the bit sequence and polarities, send them to another display then be ready for the next sequence. I am sure the Pico wouldn't manage this as well as the PIC does.

Code:
import utime
global MyMaster
global MyCounter
MyMaster  = 0
MyCounter = 0

GP0       = machine.Pin(0 , machine.Pin.OUT)
GP1       = machine.Pin(1 , machine.Pin.OUT)
GP2       = machine.Pin(2 , machine.Pin.OUT)
GP3       = machine.Pin(3 , machine.Pin.OUT)

GP6       = machine.Pin(6 , machine.Pin.OUT)
GP7       = machine.Pin(7 , machine.Pin.OUT)
GP8       = machine.Pin(8 , machine.Pin.OUT)
GP9       = machine.Pin(9 , machine.Pin.OUT)


while True:

    MyCounter = MyMaster
   
    MyCounter = bool(MyMaster & 0b00000001)
    GP0.value(MyCounter)
    GP6.value(MyCounter)

    MyCounter = bool(MyMaster & 0b00000010)
    GP1.value(MyCounter)
    GP7.value(MyCounter)

    MyCounter = bool(MyMaster & 0b00000100)
    GP2.value(MyCounter)
    GP8.value(MyCounter)

    MyCounter = bool(MyMaster & 0b00001000)
    GP3.value(MyCounter)
    GP9.value(MyCounter)

    MyMaster = MyMaster + 1

    if MyMaster > 31:
        MyMaster = 0

    # utime.sleep(0.1)
 
Last edited:

tmfkam

Senior Member
Free time today has allowed me to build the same (or very similar) program in PicAxe Basic, and I've programmed it into a 20M2. Running the PicAxe at 32MHz the lowest bit count (highest frequency) toggles at 300Hz.

In order that gives:
PicAxe 300Hz
Pico (MMBasic) 860Hz
Pico (MicroPython) 3,000Hz
PIC (Compiled) 30,000Hz

I'm not saying that my code couldn't be improved, or that some changes couldn't be made to increase the execution speed. I started with some code I used to prove the Pico was working and tried to port that as near as I could identically to all the other language dialects.

PicAxe code:
Code:
#No_Data
SetFreq M32

symbol MyMaster  =b0
symbol MyCounter =b1

'symbol GP0       = pinC.7 'pin3  - not pin2 
'symbol GP1       = pinC.5 'pin5  - not pin3
'symbol GP2       = pinC.4 'pin6  - not pin5
'symbol GP3       = pinB.7 'Moved for compatibility with PicAxe, breadboard and 'scope - 'pin11

'symbol GP6       = pinC.3 'pin7  - same as PIC16F1829
'symbol GP7       = pinC.2 'pin8  - same as PIC16F1829
'symbol GP8       = pinC.1 'pin9  - same as PIC16F1829
'symbol GP9       = pinC.0 'pin10 - same as PIC16F1829

DirC.7 = 1
DirC.5 = 1
DirC.4 = 1
DirB.7 = 1

DirC.3 = 1
DirC.2 = 1
DirC.1 = 1
DirC.0 = 1

Let MyMaster  = 0
Let MyCounter = 0

Do
    MyCounter = MyMaster
   
    Let MyCounter = MyMaster & %00000001
    Let pinC.7 = MyCounter
    Let PinC.3 = MyCounter

    Let MyCounter = MyMaster & %00000010
    Let MyCounter = MyCounter / 2
    Let pinC.5 = MyCounter
    Let pinC.2 = MyCounter

    Let MyCounter = MyMaster & %00000100
    Let MyCounter = MyCounter / 4
    Let pinC.4 = MyCounter
    Let pinC.1 = MyCounter

    Let MyCounter = MyMaster & %00001000
    Let MyCounter = MyCounter / 8
    Let pinB.7 = MyCounter
    Let pinC.0 = MyCounter

    Let MyMaster = MyMaster + 1

    If MyMaster > 31 Then
        Let MyMaster = 0
     EndIf

Loop
 

Mark.R

Member
The reason I started this thread knowing/not knowing/assuming that the forum was funded or looked after by Rev.Ed wasn't as a platform to start the advertising of the competition, though I do like a good constructive discussion about the cross platforms, but was just to high-lite my concern that the Picaxe looked to me to be slipping away! I love having the IDE PE6 where you can write and test your code without even having sorted your hardware out yet, I think it's the way to be and PE6 is laid out well, I struggle to read/write things in a basic text editor.

My hope was that if enough read and commented saying "Please" that Rev.Ed might see it and think to them selves, look lads were slipping a bit here in the market and we'd get a big push?
 

oracacle

Senior Member
I will try and remember for tonight, I have a couple arduinos and a teensy 4.0 here to translate your code to arduino C.
the teesy is 600mhz default clock, while the arduinos are 16mhz.
 

oracacle

Senior Member
OK, done a little testing, I dont think my cheap USB scope is up to par. Both wear writern in arduino IDE and programmed from there. The teensy makes use of a plugin known as teensyduino for downloading the compiled code.
First off arduino nano was showing 14.9-15khz
Code:
byte MyMaster;
byte MyCounter1 = 0;
byte MyCounter2 = 0;
byte MyCounter3 = 0;
byte MyCounter4 = 0;

void setup() {
  DDRD = DDRD | B11111100;
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);
}

void loop() {
  digitalWrite(A4, MyCounter1);
  digitalWrite(A5, MyCounter2);
  digitalWrite(2, MyCounter3);
  digitalWrite(3, MyCounter4);
  digitalWrite(4, MyCounter1);
  digitalWrite(5, MyCounter2);
  digitalWrite(6, MyCounter3);
  digitalWrite(7, MyCounter4);
    
  MyMaster++;

  MyCounter1 = MyMaster;
  MyCounter1 = MyCounter1 & 1;

  MyCounter2 = MyMaster   >> 2;
  MyCounter2 = MyCounter2 & 1;
 
  MyCounter3 = MyMaster   >> 3;
  MyCounter3 = MyCounter3 & 1;
 
  MyCounter4 = MyMaster   >> 4;
  MyCounter4 = MyCounter4 & 1;
  
  if(MyMaster>31){
    MyMaster = 0;
  }
}
The code for the teensy 4.0 was slightly different
Code:
byte MyMaster;
byte MyCounter1 = 0;
byte MyCounter2 = 0;
byte MyCounter3 = 0;
byte MyCounter4 = 0;

void setup() {
  DDRD = B11111111;
}

void loop() {
  digitalWrite(0, MyCounter1);
  digitalWrite(1, MyCounter2);
  digitalWrite(2, MyCounter3);
  digitalWrite(3, MyCounter4);
  digitalWrite(4, MyCounter1);
  digitalWrite(5, MyCounter2);
  digitalWrite(6, MyCounter3);
  digitalWrite(7, MyCounter4);
    
  MyMaster++;

  MyCounter1 = MyMaster;
  MyCounter1 = MyCounter1 & 1;

  MyCounter2 = MyMaster   >> 2;
  MyCounter2 = MyCounter2 & 1;
 
  MyCounter3 = MyMaster   >> 3;
  MyCounter3 = MyCounter3 & 1;
 
  MyCounter4 = MyMaster   >> 4;
  MyCounter4 = MyCounter4 & 1;
  
  if(MyMaster>31){
    MyMaster = 0;
  }
}
I got 250khz with a clock speed of 600mhz, but also at 816mhz too. This was before i relaised my scope was sampling @1Mhz.
Set up for 48Mhz and got 1.1-1.2Mhz foor 600Mhz clock and flicking between 1.6Mhz and 1.7Mhz @ 816Mhz clock speed.
Its only a cheap USB scope (hanteck 6022), there mayeb some inacuracies in the readings
I knew the teensy was going to be fast even before overclocking, and with cooling it can to 1008Mhz for if you need to go really, really fast
 

Buzby

Senior Member
All this 'My chip's faster than yours' doesn't take detract from the fact that Picaxe system is the easiest to use, has a brilliant simulator, and there is no way to 'brick' a Picaxe. It is a perfect solution for the educational market. However, it does not fare well outside of this large, but narrow, field.

I don't think a few like us who want more are enough to sway Rev-Ed's plans for the future. If it works, don't fix it !.

However, I am not happy with the faults and omissions in PE6.

Rev-Ed seem either unable or unwilling to address these issues. Maybe they are short on resources.

A solution here would be to 'open source' the editor/simulator, but NOT the compilers.

Educational establishments would still use the Rev-Ed version, but 3rd party developers would work together to build a better PE6+ for those who need it. Any issues with the new PE would not affect Rev-Ed's customer base, and a new forum section is where any problems could be thrashed out.

Cheers,

Buzby
 

PhilHornby

Senior Member
Free time today has allowed me to build the same (or very similar) program in PicAxe Basic, and I've programmed it into a 20M2. Running the PicAxe at 32MHz the lowest bit count (highest frequency) toggles at 300Hz.

In order that gives:
PicAxe 300Hz
Pico (MMBasic) 860Hz
Pico (MicroPython) 3,000Hz
PIC (Compiled) 30,000Hz
For completeness, I tried it on a 20X2 @ 64MHz and got 454.5Hz.
 

oracacle

Senior Member
To be fair, picaxe isn't the only system with a simulator.
Wokwi - Online Arduino and ESP32 Simulator
Thats just one, and there are loads more out there. As for bricking, yeah that pretty hard with an arduino too. And even if you, just reflash the bootloader and off you go (try doing that with a picaxe without sending it back).
Thats a massive part of the point, Picaxe doesn't have an exclusive on all those things, the tools for all the other systems are out there and so cannot be classed as being an edge over competitors.

My latest commision work needed to make use of timing multiple things (upto 10 at any given moment), and it was easy. I was able to store the running system timer that an event happened, then periodically look to see if the difference between then and the current system time is greater than an amount wihout the need for setting up a timer first. And with some timing down to about 250ms, it was great that it runs in ms (overflow every 52 days though). I have no idea how i would have achieved the same thing with picaxe

Doing things with that running timer being easy is massively importnat not only if you need to do other time critical events, but to be able to multi task (or at least give the illusion of multitasking) - this means you can get more from the your processor, this is why speed is important.
Further to that, I have even taken to using the background timer for debouncing, meaning that a pause for entire programme is not needed

Code:
if(digitalRead(SW) == LOW){
    if (millis() - lastRotaryPress > 50) {
      #ifdef debug
        Serial.println("Button pressed!");
      #endif
      sending[0] = store_LED_state;
      sending[1] = 1;
      sendit();
    }
  lastRotaryPress = millis();
  }
I use something like this all the time, the entire programme will continue running and doing what ever else even if you keep the thing depressed (providing that the beviour you are looking for) and wont acknoledge another press until the button as not not been pressed for greater than 50ms, millis() is the running timer. Its a much better approach to debounce IMHO, if you have a noisy switch then you can easily increase the debounce time, still having no effect on the rest of the programme. Even something simple like that would make the system massively more attractive. And the important thing to remember if it were to be implemented it would have to be uniform across the entire range of picaxe controllers.
 

tmfkam

Senior Member
I knew the teensy was going to be fast even before overclocking, and with cooling it can to 1008Mhz for if you need to go really, really fast
Wow! That's fast. I'll have to look into the Teensy devices. Thanks for the heads up.
 

tmfkam

Senior Member
I just tried to reproduce the Pico (MMBasic) result, but I got 759.8Hz, not 860Hz ?!?
Oh dear! I might have written it down wrongly? Reasonably sure I didn't, but I wrote the code, tested on the 'scope and then cycled home and typed it up the following day. Perhaps I gained 100Hz in my sleep!

Not very quick though is it?
 

Flenser

Senior Member
When you express the figures for interpreted BASIC as "lowest bit switches per MHz of MCU clock freq" then the three chips all look to have pretty close to the same performance:
Interpreted BASIC on 20M2 @32MHz => lowest bit switches at 9.375 Hz/MHz MCU clock freq
Interpreted BASIC on 20X2 @64MHz => lowest bit switches at 7.10 Hz/MHz MCU clock freq
Interpreted BASIC on Pi Pico @125MHz => lowest bit switches at 6.88 Hz/MHz MCU clock freq

It confirms what I might have expected. that unless the programmers of one of the BASIC interpreters happened to chose a particularly poorly performing algorithm then the different interpreters will probably perform at about the same level.
 
Last edited:

Goeytex

Senior Member
Speed is relative to the task at hand. You don't need sub microsecond or sub nanosecond instruction times to teach kids how to write BASIC code, flash some LEDs, control motors, or for many other tasks that do not require blazing speed or large amounts of memory. Picaxe fits that bill nicely.

On the other hand, many other applications do depend upon speed/memory and are not within the capability of a Picaxe. Most of us know this.

Rev-Ed's bread and butter is the Educational Market and that is where the promotion/marketing focus should be and most likely is. We do not know what is going on behind the scenes, but I imagine that Rev-Ed is working very hard to maintain/grow their Educational Customer base given today's competitive environment in that market. Time and resources spent on Youtube videos, blogs, etc aimed at hobbyists/tinkerers would probably result in net negative returns since, as I understand it, this is a relatively small part of Rev-Ed's revenue.

Any new innovation from Rev-Ed will most likely be a result of needing to catch up/ keep up with the competition in the Educational Market.

Goey
 

inglewoodpete

Senior Member
My observation of many, many technical/instruction videos on youtube is that they are made by enthusiats who have 1) made something, 2) discovered something or 3) learned something the hard way.

I think it's up to us, the PICAXE enthusiasts to make the videos if we feel so inclined.
 
Last edited:

oracacle

Senior Member
Any new innovation from Rev-Ed will most likely be a result of needing to catch up/ keep up with the competition in the Educational Market.
While they haven't as yet fallen behind with the exception of being a bit more expensive in some regards, they certianly don't have a lead either.
 

tmfkam

Senior Member
I would point out that the Pi Pico (running either MMBasic or MicroPython) is so simple to connect to a PC, requires no convoluted procedure for installing drivers and can be powered by the USB connection.

If I was still working in education I'd be recommending the Pico.

I'd probably suggest MMBasic too, it is more forgiving of the "case" of typing and indentation. MicroPython requires everything to be perfect and for beginners I think that might get frustrating.
 

erco

Senior Member
My observation of many, many technical/instruction videos on youtube is that they are made by enthusiats who have 1) made something, 2) discovered something or 3) learned something the hard way.

I think it's up to us, the PICAXE enthusiasts to make the videos if we feel so inclined.
Guilty on all counts.

As others (including Rev Ed) have said, many/most users never come to the forum. It's just us fanboys with too much time on our hands. Sharing your project and findings on Youtube is 100000X more likely to be seen by anyone.

A 10-second TicToc dance/K-pop jingle about Picaxe would be worth more than every educational video ever made. @Technical @hippy : QUICK, print some girls' crop top Rev-Ed T-shirts and start launching from cannons into the Christmas shopping crowd!

 
Last edited:

PhilHornby

Senior Member
I might have written it down wrongly? Reasonably sure I didn't, but I wrote the code, tested on the 'scope and then cycled home and typed it up the following day.
It turns out that 806Hz is the correct answer for the Picomite@132MHz ... but its default speed is actually 125MHz - hence my answer of 760Hz.

(At 250MHz, it gives a 1506Hz o/p :) )
 

inglewoodpete

Senior Member
A 10-second TicToc dance/K-pop jingle about Picaxe would be worth more than every educational video ever made. @Technical @hippy : QUICK, print some girls' crop top Rev-Ed T-shirts and start launching from cannons into the Christmas shopping crowd!
Hmm. Dancing at the "shallow end of the pool". I don't think that will reach Rev Ed's market. A mosquito would have an longer attention span.
 

tmfkam

Senior Member
I just tried to reproduce the Pico (MMBasic) result, but I got 759.8Hz, not 860Hz ?!?
Definitely getting 860Hz here. Running at the original, default frequency (I've not altered anything from the original) I actually get 857.3Hz.

Code:
SetPin GP0, DOut
SetPin GP1, DOut
SetPin GP2, DOut
SetPin GP3, DOut
SetPin GP6, DOut
SetPin GP7, DOut
SetPin GP8, DOut
SetPin GP9, DOut
Dim MyMaster   As Integer
Dim MyCounter1 As Integer
Dim MyCounter2 As Integer
Dim MyCounter3 As Integer
Dim MyCounter4 As Integer
Let MyCounter1 = 0
Let MyCounter2 = 0
Let MyCounter3 = 0
Let MyCounter4 = 0

Do
 
  Pin(GP0) = MyCounter1
  Pin(GP1) = MyCounter2
  Pin(GP2) = MyCounter3
  Pin(GP3) = MyCounter4
  Pin(GP6) = MyCounter1
  Pin(GP7) = MyCounter2
  Pin(GP8) = MyCounter3
  Pin(GP9) = MyCounter4
 
  'Pause 100 'mS Pause can accept 0.1 (equivalent to 100 uS)
  Let MyMaster = MyMaster + 1
 
  Let MyCounter1 = MyMaster
  Let MyCounter1 = MyCounter1 And 1
 
  Let MyCounter2 = MyMaster   >> 2
  Let MyCounter2 = MyCounter2 And 1
 
  Let MyCounter3 = MyMaster   >> 3
  Let MyCounter3 = MyCounter3 And 1
 
  Let MyCounter4 = MyMaster   >> 4
  Let MyCounter4 = MyCounter4 And 1
 
  If MyMaster > 31 Then
    Let MyMaster = 0
  End If
Loop
20210403_405706.jpg

Although the Owon 'scope isn't great, I don't think it is 100Hz out...
 

tmfkam

Senior Member
Definitely getting 860Hz here. Running at the original, default frequency (I've not altered anything from the original) I actually get 857.3Hz.
No. I'm not getting 860Hz. Not with the code above at least. That was the code I *thought* I was running, but on downloading that code, I am indeed only getting 760Hz...

Ahh...

If I close the 'MMEdit Chat' window I do then get 860Hz. The chat must have some overhead on the Pico as it runs in the background?
 
Last edited:

PhilHornby

Senior Member
I can reproduce that. Just having something connected to the USB seems to do it - so a dumb terminal emulation (Teraterm) has the same effect.

EDIT
It's not a fixed overhead either ... at 250MHz clock, the loop runs at either 1.5KHz or 1.73KHz with the USB terminal disconnected.
 
Last edited:
Top