Shop OBEX P1 Docs P2 Docs Learn Events
Using BS2 with Basic 1.0 — Parallax Forums

Using BS2 with Basic 1.0

KrishenKrishen Posts: 8
edited 2008-05-23 19:09 in BASIC Stamp
Hi...

I have a project to do with a BS2, but I have a code written in Basic 1.0.

Is it possible to use the BS2 with the given code, or will I need to convert it to Basic 2.0?

If I need to convert, can anyone direct me to the appropriate literature?

Many thanks in advance,

Krishen·· yeah.gif

Comments

  • ercoerco Posts: 20,261
    edited 2008-05-19 22:00
    I think you mean you have a program written for a BS1 in PBasic 1.0 that you want to port over to a BS2 using PBasic 2.0? You'll want to get the Stamp Syntax & Reference Manual at http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf to find the differences. Suggest you upgrade to PBasic 2.5 with all the new commands, as long as you're going through the conversion. The general flow of your BS1 program will still work, but you'll have to change the syntax of some (not all) specific commands for the BS2 to run it.

    The new Windows PBasic editor does a nice job of pointing out syntax errors and using different colors to show you "recognized" code. I suggest you load your PBasic 1.0 code into the editor with the BS2 and PBasic 2.0 or 2.5 directives, then let the editor point out syntax errors as you go. You'll be BS2-ing in no time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • KrishenKrishen Posts: 8
    edited 2008-05-20 16:46
    Thanks, I appreciate the help.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-05-20 18:59
    Krishen,

    You have posted this question in 4 threads in multiple forums. This is against the forum guidelines. Two of the four threads have been removed. Please post follow-up questions in existing threads in the future.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • KrishenKrishen Posts: 8
    edited 2008-05-23 19:09
    Okay, sorry about the multiple threads, I'll post in this thread and the thread titled 'Problems with Programming' in the future.

    Let me elaborate:

    I'm trying to replicate the project done here (http://forums.parallax.com/attachment.php?attachmentid=50010), and I've run into a few problems.

    Primarily, I'm struggling with the conversion from Pbasic 1.0 to 2.5. Is it possible to use the code given in the link for a project using the BS2? That appears to be what the original people who did the project managed to do, but I don't understand how it would be possible.

    Again, would it be at all possible to use the code given to get the project to work with a Basic Stamp 2?

    Many thanks in advance,

    Krishen


    EDIT: This is what I have so far, converted from Pbasic to Pbasic 2.5:

    PCell··· PIN 0
    PCellPin CON 0
    Light1·· PIN 1
    Light2·· PIN 2
    Light3·· PIN 3
    Scale··· CON 200

    OUTPUT 1
    OUTPUT 2
    OUTPUT 3

    read_pcell:
    · RCTIME pcellpin,scale,B2· ' This might need to be fixed to read the capacitor properly.
    · DEBUG B2
    · GOTO read_pcell

    is_light1_on:
    · IF B2>200 THEN light1_on

    light1_off:
    · light1=0
    · GOTO is_light2_on

    light1_on:
    · light1=1

    is_light2_on:
    · IF B2>100 THEN light2_on
    light2_off:
    · light2=0
    · GOTO is_light3_on

    light2_on:
    · light2=1
    is_light3_on:
    · IF B2>40 THEN light3_on
    light3_off:
    · light3=0
    · GOTO is_light4_on

    light3_on:
    light3=1
    is_light4_on:
    GOTO read_pcell

    ' End of code.

    Is this properly converted?

    Post Edited (Krishen) : 5/23/2008 7:21:05 PM GMT
Sign In or Register to comment.