converting to assembler

LPG

New Member
If i want to use the Convert Basic to Assembler function it says it requires programmer. What does this function do? does it load the basic program onto a normal PIC chip?, if so do i just plug a normal PIC chip in the same way as i do a picaxe? Is it possible to veiw the assembler code?
 

LPG

New Member
(I am using a picaxe 08m and want to be able to write the program to a 12F683 chip. what is a programmer?)
 
Last edited:

hippy

Technical Support
Staff member
A programmer in this sense is a device which can put a program into a blank microprocessor. For a Microchip microcontroller like the 12F683 Rev-Ed's programmer (BAS800) does that and looks like this ...

http://194.201.138.187/WebRoot/Store/Shops/Store_002E_TechSupplies/Products/BAS800/BAS800.jpg

Rev-Ed themselves use a programmer ( not that one ) to put code into a 12F683 to turn it into what we know as a PICAXE-08M.

Once you've written a program for the PICAXE, if you own the BAS800 above, you can convert that program into Assembler which can then be burnt into a blank 12F683 or other PICmicro. It doesn't make it a PICAXE but it will run your converted PICAXE program.

You cannot do this conversion unless you own the BAS800, and be aware that it doesn't support all PICAXE commands so cannot convert all programs. For more information, start up the Programming Editor, click on Help, then Assembler Datasheets
 

LPG

New Member
does that mean i could buy a programmer and use it to program cheaper blank chips from the picaxe programming editor?
 

hippy

Technical Support
Staff member
Yes. But do read the datsheets I refered to and note the limitations. It is not the case that you can use this and cheaper chips and do all that you can with a real PICAXE, you cannot.

Also, don't forget that while saving money on chips you still have to buy the programmer.
 

retepsnikrep

Senior Member
I fell for this as well sadly. Same idea as you, do a nice program in Basic convert to assembler see/learn how it works and then upload to blank chips. :(

No chance, the range of available commands is VERY limited.

I though I had a simple program, but had to chop it down to almost nothing before it would asemble :rolleyes: very dissapointing :(
 

demonicpicaxeguy

Senior Member
i personally would recomending the pickit2 as far as programmers go i've had one for over 12 months now it's seen plenty of use and so far not a problem with it
as far as compilers go..... apart from my own concoction the PIC simulator IDE has a really good basic compiler in it as well recent usb hid support
trouble is it's got no real forum so if you want help you're on your own
 

womai

Senior Member
Just my 2 cents, but I do not see much use in programming a modern microcontroller in assembly. IMHO that's just a needlessly hard way of doing things, and a good compiler (e.g. Basic or C) produces code that in 99% of the case is just as efficient (or more efficient, unless you are a really experienced assembly programmer!), with 10% of the effort on the programmer's side. And any decent compiler will let you insert short sections of machine code in places where this is absolutely necessary (e.g. to have super-precise execution timing, or to access features the compiler does not expose).

Both with compiled Basic and with assembly you'll need a programmer to burn the program onto the chip, so hardware costs are the same. And there are several compilers out that offer a decent free version. I recently got myself the Mikroelektronika development board and MikroC compiler; I paid for the full version (doesn't break the bank), but their free version produces up to 2K of machine code. I have yet to write a program that is larger than that (my largest fills just 1.5K), and my guess that is true for most people on this forum. Converting a 500 line Picaxe program to MikroC took me just over a day (but I have to admit I worked part-time as a professional software developer in C/C++ for a few years).

As a plug for the Picaxe though, on average don't expect gigantic gains in execution speed by going from a Picaxe to a compiled program (or assembler). I frequently heard factors like 100 - 200 or more, but in practice that's only true for very simple tasks - toggling an output pin being one of them (and that is frequenty taken as a simple but quite useless benchmark). Once you go to more complex tasks (reading the ADC, using the serial port), that advantage is reduced my a lot. The reason is that the time to parse an command on a Picaxe is about the same all the time, but the actual effort to execute the task strongly varies, and some tasks (e.g. readadc) can't be done infinitely fast.

I converted two larger programs so far, and the speed gain I observe is more of the order between 5 - 15. That is after optimizing both the Picaxe code and the C code on their own as far as I could. Still not bad, but not as gigantic as most people would assume, and the required hardware and software is definitely much more complex than the Picaxe programming editor and the Picaxe download circuit (although Mikroelektronika is doing an excellent job in making it as painless as possible).

If course all that's my personal opinion, and I'm sure others may disagree!

Wolfgang
 
Last edited:

papaof2

Senior Member
I've only seen a few instances where changing from an interpreted language to a compiled language gave a huge increase in speed.

UNIX shell script to C - 15 to 20 minute run time (depending on system load) to less than 30 seconds run time. That's about 40 to 1.

GWBASIC to Turbo Basic - typically 50 to 1 improvement because of the "compile to native code" capability of TB.

dBase script to C - 3 hour run time to 2 minutes. That's a 90 to 1 improvement. This was an extreme case of someone doing "the only tool I have is a hammer" programming :-(

I have MPLAB, Basic and C compilers, and a PIC programmer, but haven't yet needed to go that route. It's faster and easier to move up to a bigger chip with a 16 or 20 MHz crystal (4 or 5 times improvement). This doesn't compute for commercial work where there will be hundreds or thousands of chips used, but it works for this hobbyist ;-)

John
 

womai

Senior Member
Mycroft,

on the PIC I have only ever really played with Mikrobasic - in terms of functionality it is virtually identical to MikroC, I suspect the only true difference between the two is the parser. It's also very easy to learn if you know VB6. In combination with their evaluation board it is the easiest compiler approach I have found so far. But nothing can beat the Picaxe for a beginner, and I will for sure stick to Picaxes for fast prototyping.

Wolfgang
 

moxhamj

New Member
It may be a bit awkward to talk about pic compilers on a picaxe forum, so perhaps I'll preface this by saying that for my hobby work, picaxe is still the answer for all my problems. It is just so quick - conceive an idea and you can have a working device in only a few minutes on a breadboard.

But when it is time to make 20 boards of the same design, a raw pic programmer has advantages as the raw chips are so much cheaper http://www.futurlec.com/ICMicrochip_PIC16.shtml

Re compilers, the instruction set can be quite informative. Eg with these two examples, there are a number of LCD routines that can simplify code, as well as floating point maths and a timeout system for serin.

http://www.oshonsoft.com/picbasiccompiler.html

http://www.mikroe.com/pdf/mikrobasic/mikrobasic_manual.pdf
 
Last edited:
Top