A Few Questions...
Hi All,
I have been designing something using the BS2PX stamp. I successfully completed that project, but now, to make things more cost efficient, I'd like to swich over·to the SX. The program I originally wrote used several program slots on the BS2PX. I haven't read anywhere about using "slots" on the SX. I think I can rewrite the code to work on the SX in a sequential manner. I am running into a few problems, however.
First, the GET and PUT commands, and their use involving memory locations. For instance, the following instruction doesn't seem to work as I thought it would on the SX/B: IF Input1 = IsOn THEN PUT 1, A - this, as I'm sure you all know would do the equivalent of looking at Pin1, and if it were ON, put VARIABLE "A" in memory location 1.
Secondly, the GET command. Say, for instance, this:· GET 1 followed by : IF 1 = A, THEN GOTO ROUTINE·· This would be the same as geetting the variable from memory location 1, and IF it equaled "A", then switch off to another routine. How do I access and work with these variables and memory with the GET and PUT commands?
If I could get this figured out, and make the programs run successfully on the SX would be a great thing. I also would liek to know if anyone has a link to anything useful / program examples of the SX/B (not assembly, will work and study that soon) language....
I have been designing something using the BS2PX stamp. I successfully completed that project, but now, to make things more cost efficient, I'd like to swich over·to the SX. The program I originally wrote used several program slots on the BS2PX. I haven't read anywhere about using "slots" on the SX. I think I can rewrite the code to work on the SX in a sequential manner. I am running into a few problems, however.
First, the GET and PUT commands, and their use involving memory locations. For instance, the following instruction doesn't seem to work as I thought it would on the SX/B: IF Input1 = IsOn THEN PUT 1, A - this, as I'm sure you all know would do the equivalent of looking at Pin1, and if it were ON, put VARIABLE "A" in memory location 1.
Secondly, the GET command. Say, for instance, this:· GET 1 followed by : IF 1 = A, THEN GOTO ROUTINE·· This would be the same as geetting the variable from memory location 1, and IF it equaled "A", then switch off to another routine. How do I access and work with these variables and memory with the GET and PUT commands?
If I could get this figured out, and make the programs run successfully on the SX would be a great thing. I also would liek to know if anyone has a link to anything useful / program examples of the SX/B (not assembly, will work and study that soon) language....
Comments
Notice that I call your memory location 1, "tmpB1," as SX/B does not allow variable names to begin with numbers.
In conditional cases, you do not need to use a separate instruction to fetch the operand.
It's a little different than higher level programming languages where a single equals ("=") symbol signifies an assignment and two equals ("==") symbols are used for comparisons. In SX/B, the single equals symbol is used for both.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Paul
Post Edited (Velocit
If you post the code (or portion of code) you are trying to convert we can help you.
As Paul stated, the SX does not have internal EEPROM memory.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·
I will be posting both my BS2PX codes, and also the SX/B code i have come up with. I am away from my home machine at the moment, but will be posting the codes when I returrn home.
Maybe I can get some things straightened with you guys help, which is greatly appreciated...
I am making some headway here on my own. I have come up with a SX/B sequential program that is workingin most routines. The only problem I am having now is that when the program starts, it will not jump to FAILED if pin 1 is high. It will however go to the next routine, INITIALIZE, if pin 1 is low on startup. It will go to other routines if pin 1 goes high later though... stumped here.
I know this code isn't all that pretty to look at. I will clean it up later, and remove the junk that I dont need.
This should give you guys an idea of waht I'm trying to do here. I appreciate all responses and advice.
Now, I also have a few style criticisms for you as well. For starters, look into using the programming template found in the SX/B help file. It helps keep your code more organized and easier for others to read. The same goes for using lots of white space and tabs/spacing -- I'm not sure if that was lost in the upload/download process, or if you omitted it from the start.
You can define a pin's data direction in the same line of code that you define its name. Notice how I did it in the revised version I uploaded.
You'll quickly run out of memory if you use bytes where bits would suffice. Become familiar with words, bytes, bits and arrays and know when to use each. Again, notice how I did it in the revised version I uploaded.
Then there are just a few small code optimization techniques you should be aware of... when using an "IF...THEN" statement in conjunction with a "GOTO" statement, you can simply write it as "IF condition THEN GOTO label" in one line: no "ENDIF" is needed. Also, where you wrote "IF SIGNAL = 1 THEN STATUS1 = A ENDIF," etc.; since SIGNAL and STATUS1 are now both bits, you can simply write "STATUS1 = SIGNAL."
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Paul
Post Edited (Velocit