Shop OBEX P1 Docs P2 Docs Learn Events
I to II conversion — Parallax Forums

I to II conversion

CharlieCCharlieC Posts: 14
edited 2005-03-11 20:09 in BASIC Stamp
Ok, now I feel dumb.· I am trying to learn to control a stepper with the BS2.· I figured I'd try and convert the example in the Basic Stamp App notes to BS2.· For a guy like me that's been developing software for mor than 20 years, should be a piece of cake, right?

Well I understand the #=INC AND %=BIN? part ok, I think but when I try to convert ...
dirs = %01000011··· into······ dirs = BIN? 01000011, I get a "Constant exceeds 16 bits",
I don't get it.· Last time I checked 01000011 did not exceed 16 bits.

But then, my gray matter is getting a bit arthritic.· Just in case one of you guys what to help out a very old (and not so bright anymore) fart, I have attached the code I am trying to convert.· If not, I don't blame you.· This should not stop me.



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm

That part, at least,·I'm sure of.

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-11 01:26
    1. The "%xxxx" syntax for binary constants still works in the BS2.

    2. There is no "T2400" constant in BS2 -- you'll need to define it yourself

    3. Each "Symbol" line: "Symbol xxx = YYY" must be converted to : "xxx VAR YYY"

    4. DIRS is now a 16-bit variable (because the BS2 has 16 I/O pins). PINS similarly.

    5. You no longer prefix variables with # or %.
    SERIN 7,N2400,Dir_cmd,#Steps,#Delay ' Get orders from terminal.

    becomes:
    I2400 CON 16384 ' or whatever the 2400 baud number is for the BS2. Look it up under SERIN in the manual

    SERIN 7, I2400, [noparse][[/noparse]Dir_cmd, Steps.HighByte, Steps.LowByte, Delay]

    Update:
    · Direction VAR BYTE· ' This makes an 8-bit variable in BS2
    · Steps VAR WORD· ' This makes a 16-bit memory variable
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-03-11 06:07
    Charlie,

    ·· Your code example posted uses the extension for older BS1 code.· Could you please confirm that this is for a standard BS2?· You should use the proper extensions when saving the file, as well as adding the proper Stamp directive.· That is in addition to what Allan pointed out.· Are you using the most current Stamp software?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Tech Support
    csavage@parallax.com

    Post Edited (Chris Savage (Parallax)) : 3/11/2005 6:11:30 AM GMT
  • CharlieCCharlieC Posts: 14
    edited 2005-03-11 14:42
    I guess I, once again, did not make myself very clear.· The file that I attached was the original from the BS1 app notes.··I believe that Allen cleared up a lot of my confusion and I am currently trying it again.· Thank you both for your input.· Sometimes, I just need a little gas down the carborator.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Charlie Chisholm

    That part, at least,·I'm sure of.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-03-11 20:09
    Okay,

    ·· I thought the attached code was the code you were trying to run.· Good luck, and if you get stuck again, please post the converted code for comparison.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.