Convert my old .bsx-files to .asm or .hex-files?
J.We
Posts: 15
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
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
Comments
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
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.
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.
The BASIC Stamp compiler uses a completely different file format for its compiled interpreter byte codes. You can't flash a PIC16F57 with the BASIC Stamp compiler. The Stamp module has a downloading program built into it which accepts the file from the PC and loads it into a separate 2K byte EEPROM on the Stamp module. The PIC16F57's flash memory contains the PBasic interpreter and the downloading program and can't be changed except by Parallax.