Shop OBEX P1 Docs P2 Docs Learn Events
How do I convert my BS2 programs to SX/B — Parallax Forums

How do I convert my BS2 programs to SX/B

meredth78meredth78 Posts: 18
edited 2006-04-27 10:34 in General Discussion
I just got my SX kit and would like to start replacing my $50 BS2's with SX chips. How do I go about converting my old BS2 programs to the SX/B? This may be a stupid question, but how similar is the BS2 language and the SX/B language?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-07 23:37
    The best place to start is by reading the SX/B help file -- you'll find lots of common ground with PBASIC, but many key differences. There are several demos in the help file that should help as well.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • meredth78meredth78 Posts: 18
    edited 2006-04-07 23:54
    i cant open my help file. it says "cannot open the file: mk:@MSITStore:C\Program Files\Parallax Inc\SX-Key v3.1\Compilers\SXB\SXB.chm", i tried to uninstall and reinstall.

    Post Edited (meredth78) : 4/8/2006 12:51:51 AM GMT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-08 01:26
    Do you have the latest version of Internet Explorer installed? -- it provides necessary components for the help file system (you don't have to use IE, just have it installed).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • hutdonhutdon Posts: 32
    edited 2006-04-08 01:58
    I don't know if this is your problem or not. I have XP home ed at home (duh) and XP pro at work. At home I had no problem with the help files but at work I too got an odd error message every time I tried to open it. I went to the compilers/SXB directory and right clicked on the help sxb.chm file. There was a box at the bottom of the properties pane that had something to do with read security that I either check or unchecked. What it said exactly and whether I check or unchecked - I can't remember and can't get the message to come back. But - it solved the problem. I can get the help file!
  • meredth78meredth78 Posts: 18
    edited 2006-04-09 03:42
    i use IE typically. everything is updated and it had worked once before. now i get the above ^ error
  • DunnseptDunnsept Posts: 115
    edited 2006-04-10 02:11
    .chm is a compiled help file. Some of the later windows security "fixes" broke CHM files because there are serious security vulnerabilities in them.
    there are 2 things to try. First right click the file and then choose Properties, if available, uncheck the "unblock" if it's there. If this does not fix it, try (from a command prompt) regsvr32 itss

    http://support.microsoft.com/kb/902225 for more info
  • James NewtonJames Newton Posts: 329
    edited 2006-04-10 21:54
    This is silly. CHM files are HTML. If you have access to the web, you should be able to browse HTML content from a web site if not from your own machine. I've put the latest manual up on sxlist.com at

    http://www.sxlist.com/techref/parallax/sxb/sxb/___index.html

    At least until someone tells me to take it down.

    There: Now you can see the examples.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



  • Mike WMike W Posts: 105
    edited 2006-04-11 02:44
    meredth78

    I have converted some of my BS2 programs to SX/B and·some of the obsticles I have encounted·are

    some of the math operators are different

    it is harder to work with 16 bit numbers and·remainders in division

    but I am new at this too.



    Mike W
  • meredth78meredth78 Posts: 18
    edited 2006-04-13 22:29
    thanks Dunnsept that worked perfectly.


    now that i have the help files working again, i ran into a problem.

    how do you write something like.... IF· rb.0 = 1· AND· rb.1 = 1· THEN...?
    it seems that BS2 and SX/B differ here, with SX/B only allowing ByteVar = Value1 AND Value2

    Post Edited (meredth78) : 4/14/2006 4:33:44 AM GMT
  • DunnseptDunnsept Posts: 115
    edited 2006-04-14 12:42
    I'm pretty sure that the SX/B help files say that the condition for an IF then must be "simple"
    I've tried compound conditionals and also never got them to work, so I followed the examples in the SX/B help:

    if rb.0 = 1 then
         if rb.1 = 1 then
            'do something
         else
            'do something else
         endif
    endif
    

    There may be 'better' ways to do these things, there may be more elegant/less code solutions too, but I think that unless your
    project is really time-critical, sometimes it's best to get it to work first, in an easy to read/understand format and then go from there
    once you have a better grasp of the language/syntax/architecture (ha, look at me, I'm still a super newbie on these things)
    I can only think of all of the obfuscated C++ code we used to try to write, it was fast, it was small, but impossible to pick apart to
    see what the heck it was doing.

    paul...

    Post Edited (Dunnsept) : 4/14/2006 12:46:22 PM GMT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-14 15:16
    You're right: you cannot do compound statements so the stacked IF-THEN above is probably the most elegant way to go.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • meredth78meredth78 Posts: 18
    edited 2006-04-14 20:03
    thanks guys
  • Benjamin_bakerBenjamin_baker Posts: 18
    edited 2006-04-27 09:03
    Just out of curiosity, does


    if RB.0 then

    compile the same as

    if RB.0 = 1 then

    ?
  • BeanBean Posts: 8,129
    edited 2006-04-27 10:34
    Ben,
    NO it doesn't. You need to specify the complete comparison, that is "IF RB.0 = 1 THEN".

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com


    COMING SOON "SD DATA LOGGER" www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
Sign In or Register to comment.