BS2 to BS1 code help needed
Kristen
Posts: 19
Hello,
I am new to stamp and have short code for the BS2 completed.· I am now switching to BS1 and need to change the code.· Is there anyone who could help me convert the code?
Thanks!· Kristen
I am new to stamp and have short code for the BS2 completed.· I am now switching to BS1 and need to change the code.· Is there anyone who could help me convert the code?
Thanks!· Kristen
Comments
If you post your code, you'll have a good chance of getting help. Lots of terrific people here wanting to assist!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
Post Edited (erco) : 10/24/2008 3:24:49 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
I see NOCONFIRM_13 (and others) used both as a variable in a SERIN command and also as a label. Can't be both.
Are you using a motor driver chip, if so, which one?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
But you are trying to use "THEN GOTO", but PBasic 1 has some "peculiarities". For instance:
IF PIN6 = 0 AND Time = 60 THEN GOTO MotorClose
should be:
IF PIN6 = 0 AND Time = 60 THEN MotorClose
The GOTO is implied. THEN automatically will "goto" (label) Motorclose
As for: IF PIN2 = 1 OR PIN4 = 1 THEN Time = 0
I believe IF statements in PBasic1 can only result in that implied "goto" statement. That is, you can't change variable Time. Not directly, anyway. Here's how I do it by adding new labels "newlabel1" and "newlabel2":
IF PIN2 = 1 OR PIN4 = 1 THEN newlabel1
goto newlabel2
newlabel1:Time = 0
newlabel2: ...
or more directly (changing your IF statement) with new label "skipreset":
IF PIN2=0 AND PIN4=0 then skipreset
Time=0
skipreset: ...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
Post Edited (erco) : 10/24/2008 7:09:08 PM GMT
The BS1 does not support SERIN timeouts and the format of SERIN and SEROUT statements is slightly different from BS2 Basic.
You really need to sit down with the Basic Stamp Manual and your program, look at the various statements you're using, and
check the manual for each one to see what's different from BS2 to BS1. You might go through the conversion tips again.
It's a tedious process, but straightforward once you familiarize yourself with the differences.
Kristen: Don't be frustrated by the BS1 differences, it's a great chip and well-suited to many applications. I have enjoyed this thread just to remind myself of the BS1, where I started in 1994!
Have you verified that the BS1 serout/Serin speeds are fast enough for your Motor Mind controller? I found that the BS1 was not fast enough to send serout data to the SX Video Module, so I was forced to use a BS2 in that application.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
For the main do loop.· I understand the loop becoming a GOTO Main, but what would the Do change to?· Neither is in the conversion doc.
Regarding the serin/out with the BS1, I think I should be all set.· I confirmed each of my components with the Parallax tech guys before trying to switch to the BS1.· The BS2 is a great board, just a lot more than is required for this application.
I've attached my work in progress thus far.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Now, the remaining issue seems to be with my motormind b enhanced portions (MotorClose, Off, MotorOpen) and the few related lines before Main.· I followed all the conversion doc tips and eliminated the [noparse]/noparse and the GOTO's.
Does anyone know how to convert the final motor sections?
Thanks!
Please add·generous comments throughout your motor control section so we can see exactly what you're trying to do. I see you have a few "PAUSE 1" commands, which will only pause for 1 millisecond. Is that what you wanted? Did this code work perfectly with a BS2? Do you have a link to a Motor Mind spec page?
erco
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
Here is·a BS1·sample code for the Motor Mind B Enhanced. Notice there are no timeout commands in this example since it's not supported by·PBASIC 1.0. In the·following example, it will move the motor and send DEBUG commands to the terminal to indicate action; also the BS1 uses only 1 I/O (0 in the·example) for TM and FM.
I hope this helps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Joshua Donelson
www.parallax.com
Post Edited (Joshua Donelson (Parallax)) : 10/29/2008 11:27:45 PM GMT