PDA

View Full Version : Convert my old .bsx-files to .asm or .hex-files?



J.We
01-19-2007, 05:32 PM
Hi,

Can I use the Basic Stamp editor to create a program, compile and from the .bsx-file see the .ASM-file or .HEX-file?

Or is this converting done in the hardware (I use a BS2sx)?

I want to use my old .bsx-files convert them to .ASM or .HEX and program them into another microprocessor (PIC)…

Do you have any suggestions?

Thanks in advance!

(I have also posted this subject to the STAMP in Class forum)

Regards
jw

Forrest
01-19-2007, 06:33 PM
The Basic Stamps can only run Basic, not assembly/machine language progams. If you want to switch to a PIC processor you'll need to convert your programs to the other version of Basic that runs on those processors and get a Basic compiler (which can cost up to $300) and a programmer. I'd look at the inexpensive Parallax SX processor (which is a fast version of a PIC processor), the SX Blitz programmer and the free SX/B compiler.

Bruce Bates
01-19-2007, 06:45 PM
JW -

Just to add a bit more information to this thread, PBASIC is an interpretive languafe, not a compiled language. There is an intermediate code-form, but it is neither ASM, HEX, nor machine code. The intermediate code is often known as "tokens" and these tokens are first fetched by the PBASIC Interpreter, then interpreted, and finally executed via interpretation.

Moreover, unless you made some special provisions, one could not even take the intermediate code designed to run on one Stamp model, and load it and run it on another Stamp model. It would have to pass back through the PBASIC IDE in source languiage form, with the new target processor identified.

Regards,

Bruce Bates

allanlane5
01-19-2007, 09:41 PM
Other vendors do make compilers that do this. And the boards you'll need to plug the 'native' PIC into in order to get it to work, and give yourself a programming platform for it. But the price is around $350 for the compiler, and you WILL need at least one board to use for programming.

And even then, you'll have to 'tweak' your PBasic code to make the other compiler happy. But it can be done. This makes sense if you're delivering to your customer more than 10 systems, and especially if you're making your own boards, as the price of the native PIC is much less than a BS2.

But the BS2 is still one of the best prototyping and 'try-out' environments around.

allanlane5
01-19-2007, 09:47 PM
Oh, and the way the BS2 works is --

On the BS2 is a PIC chip (different flavors of BS2 use different chips -- PIC16C57 is the 'plain' BS2 pic chip). In this chip is programmed the 'run-time' routines, which are Parallax proprietary, and not user accessible.

In the IDE, you write your program using PBasic. The IDE then compiles each keyword into 'tokens' (an integer, basically). The IDE then downloads these tokens to the on-BS2 eeprom chip. The BS2 runtime, when running, then fetches each token from the eeprom. Each 'token' is then used by the run-time on the PIC to select and run a small piece of code which implements the functionality for that keyword.

So you see, your code is not complete UNTIL you download it into some BS2 chip, because the run-time routines are never included with your code. Now, the way compiler vendors work, is they supply a linkable library of their run-time routines so you CAN have a complete .hex or .bin file to download to a completely empty PIC.