Migration from Basic Stamp to SX using SX/B
![WBA Consulting](https://forums.parallax.com/uploads/userpics/358/nE82I1MYQ1NPJ.png)
It hit me the other day that if SX/B is a basic compiler for SX devices, any of my Basic Stamp projects should work on an SX.
1) How true is that statement?
2) How long would it take "joe the stamp programmer" to migrate a project over to SX/B?
3) How troublesome would it be to changeover a BS2P40/Sensirion SHT11/Vmusic2 USB datalogger program over to an SX28?
http://forums.parallax.com/showthread.php?p=792332
With SX chip prices at $3.95 and my BS2P40 at $89, you could see why I am interested. Currently, my projects are limited to my single BS2P40 or my Homework Board. (IE: only two usable projects at a time). I'd love to be able to start using SX so I can leave my projects in a finished state, without buying the more expensive Stamp modules or without having to learn a completely new language (IE:spin since props are so cheap too)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
1) How true is that statement?
2) How long would it take "joe the stamp programmer" to migrate a project over to SX/B?
3) How troublesome would it be to changeover a BS2P40/Sensirion SHT11/Vmusic2 USB datalogger program over to an SX28?
http://forums.parallax.com/showthread.php?p=792332
With SX chip prices at $3.95 and my BS2P40 at $89, you could see why I am interested. Currently, my projects are limited to my single BS2P40 or my Homework Board. (IE: only two usable projects at a time). I'd love to be able to start using SX so I can leave my projects in a finished state, without buying the more expensive Stamp modules or without having to learn a completely new language (IE:spin since props are so cheap too)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
Comments
2) I don't know, I haven't extensively worked with Basic Stamps before so I'm the wrong person to ask. I can say that it will depend on the complexity of the code. There are some things you have to take into consideration when migrating code to different controllers/languagess
3) The SX/B instruction set is basically almost identical to the Basic Stamp (albiet with some differences). So porting the code for the sensors and stuff shouldn't be too difficult, once you have the grasp of the SX/B language (which will be easy since you already know PBASIC).
Then you can go on to learn·some SX assembly (SASM). With SASM, you can exploit the most power from the SX (which is quite powerful) in the most efficient way possible. The learning curve for SASM is much steeper, however.
SX/B has a much more gentler learning curve, but allows for the mixing of SX/B and SASM. This way, you can optimize the performance critical parts with SASM and write the rest in SX/B. It's sort of a middle ground.
The SX can do some things basic stamps can't, like multitasking. For example, you can have a serial UART running in the background while the SX is busy doing something else. I have one application where an SX was able to run multiple servos, handle multiple rotary encoder inputs, and a UART for desktop computer control, without breaking a sweat.
The SX/B Help manual in the SX IDE has a bunch of sample SX/B projects and·example·code·- things like interfacing a DS1620, a timer with a 4 digit·7-segment display, interfacing a serial LCD, and even an 8-bit ADC. Some of the more recent Nuts and Volts columns (you can download from the Parallax site) has some more neat project ideas using the SX.
That is exactly what SX/B was designed to do.
It depends on the PBASIC program. Some are really easy to convert. Some require more work. PBASIC programs with lots of math will need some work, as SX/B only allows one operator per line. So you may need to use some temporary variables.
I say, give it a try. We are always here to help if you get stuck.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
Thanks!!!! That was the response I was looking for. I have already installed the SX/B IDE and started going through a few of the sample programs to "take a peak". I would say that most of my programs are very basic (no pun intended) and I can easily make small PCBs for the SX20/SX28 chip.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio
Good luck, but keep in mind that SX/B is not an optimizing compiler. Memory usage is a bit different. For example, every PAUSE command spits out all the code needed to PAUSE, so you can waste memory if you issue the command frequently (make a subroutine to save memory). I suggest you do a bunch of small programs before attempting to port a larger one. The help file and 'practical SX.B 1 and 2" are good places to start
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thomas Talbot, MD
Gunpowder, MD, USA
I have downloaded practical SXB and pulled out the SX28 DIPs, resonators, SX-Key Manual, and Gunther's SX programming Guide that came with my PDB 2 years ago. Hoping to spend some time with a few sample programs over the next couple weeks. My first goal is to port my SHT11 datalogger program over. I'm thinking of picking up one of each of the SX28 and SX48 proto boards since they are so inexpensive.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio