Convert our PICAXE .bas programs to .hex or .pbp file to program PICs?

zorgloub

Member
Hello everyone.
What would be the easiest and fastest way to program a .bas program that runs on a Picaxe 08M2 to a PIC12F675, for example?
Or is there a "converter" from our .bas programs to a .hex file compatible with the aforementioned PIC or others?
If I understood correctly (?), it seems to me that there existed in the 90s, a picaxe BAS800 kit which made it possible to program certain PICs, obsolete today, directly from the Picaxe editor.
In short, how can we easily switch from our .bas programs for picaxe to a .hex file to place it in a PIC with a classic programmer?
(or to .pbp files for Pic Basic Pro Compiler)
Thank you for your help and support.
 
Last edited:

hex

Active member
I am very new to PICAXE, but familiar with PIC MCUs in general

I see no way to use PICAXE programs with PIC12F675
PICAXE requires a bootloader program to be pre-programmed into the chip
No PIC12F675 bootloader was ever sold in any PICAXE device, as far as I know

You could write PICAXE programs for the now obsolete PICAXE08 (PIC12F629) or PICAXE08M (PIC12F683), but you would need to find a supplier for these obsolete PICAXE parts pre-programmed. A bare PIC will be of no use. Bootloader cannot be bought alone, only pre-programmed into a PIC

The only sensible choices that I see are:
1 buy newer PICAXE08M2+ and program with PICAXE BASIC
2 re-write program using another toolchain, such as Microchip XC8 or MikroBASIC Pro perhaps (both have free compiler versions), or just re-write from scratch as a PBP program

What you seem to want is impossible if I understand correctly
 
Last edited:

hippy

Ex-Staff (retired)
In short, how can we easily switch from our .bas programs for picaxe to a .hex file to place it in a PIC with a classic programmer?
That is going to be pretty much the same as converting PICAXE Basic to code which will run on any other microcontroller. It's going to need someone who understands what the PICAXE code is doing and knows how to rewrite that in a language the microcontroller supports. Once the source is converted the tools should be able to convert that into a binary executable to use.

The old BAS800 serial programmer is a legacy product from a long time ago. Most of the chips it supported are, as you note, obsolete and what it could handle was extremely limited. I believe it was intended for schools when they were still using PICmicro chips alongside PICAXE where its limitations weren't that problematic.

As much as I have been less than impressed by ChatGPT some have said converting code from one language to another is one of the things it can help with but I don't know how well it would perform. You would probably need to do some tweaking of whatever it produced which would still require some understanding of the PICAXE code and the target language to ensure it was correct.

How easy it is to convert a program from or to PICAXE Basic will depend on how complicated the program is. If it's short, simple and easy to comprehend it might be a straight forward task. If it uses thinks like multi-tasking it could be quite difficult if the target language doesn't support that.
 

papaof2

Senior Member
As a former member of the "Skunkworks" at a major telecom, I expected to hear "And you can have that done tomorrow?" tacked on to the request. I would suggest the person wanting the conversion draw a flowchart, convert the PICAXE code into generic logic statements and then see if they can re-write that logic and flow in the other language. If I sound like a college level programming course, you're correct - that's the only way for limited humans without benefit of AI to accomplish those things ;-)

As the former administrator of a floor full of Unix support computers, I had the "joy" of converting useful shell programs the users had created into compiled C so they would run in an acceptable time frame - such as under 2 minutes versus 20 minutes - there was only so much computing horsepower in a DEC PDP 11/70.
 

zorgloub

Member
Hi Hippy.
In fact, I already usually converted my usual Picaxe programs to PBP code to then program them in a Pic which, in fact, has the advantage of performing certain operations a little faster, since it does not require an interpreter .
My principle being to develop the prototype on Picaxe and finalize with a cheap protected PIC.
I was simply making this request to find a "powerful translator tool" to be able to convert more easily, and without error, more complicated programs as you point out in your answer.
But this seems to be the search for the Holy Grail! ;))
 

hippy

Ex-Staff (retired)
But this seems to be the search for the Holy Grail!
Technically it's not too difficult, is basically a matter of taking each PICAXE command and translating it into an equivalent in another language, which is what can be done by hand. The rules one would use to do that by hand could be turned into code to automate the process.

In fact that's what PE6 does when students are coding using AQA and OCR Assembly. It converts each line of assembler to a sequence of Basic commands which achieves what's wanted. It's the same for other 'transpilation' efforts such as converting Python to C.

The problem is that nothing currently exists for PICAXE Basic, and one would need to find someone with the skills to create such a tool and have enough motivation to do it and iron out the bugs. It's rather a niche adventure and most people can probably think of better things to do.
 

regpye

New Member
Ask ChatGPT...it's only a matter of time.
We all need to teach chatGPT how to program in picaxe basic because at present it is very limited and makes many mistakes.
I am only a learner myself, but have had to work out and work through many mistakes that chatGPT makes.
It does however thank me at the end which is a little rewarding so to speak.
 
Top