Shop OBEX P1 Docs P2 Docs Learn Events
That wretched backslash! — Parallax Forums

That wretched backslash!

TinkerTinker Posts: 12
edited 2004-12-29 16:24 in BASIC Stamp
I'm a newby to Stamp Basic and struggling. I haven't been able to find a reference for the backslash operator. I use the Basic Stamp Manual, Ver 2.0 and haven't found it (backslash) defined yet. I saw that the new version (2.1) of the Basic Stamp Manual has been released and is available for download. I scanned the new version using the Adobe reader and still haven't come across the backslash operator defined. The context in which I find it used is the I2Cout and I2Cin commands. From the context of the backslash it would appear that it indicates that the two pieces of data are to be concatenated, but I could be completely wrong. There are some pretty sharp and experienced PBasic programmers on this forum, from what I have been reading. Could one of you enlighten me? Tnx

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Two roads diverged in a wood and I..I tooked the one less traveled by.

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-29 16:10
    The back-slash operator is used in some commands (like I2Cout, or SERIN/SEROUT) as a modifier. In SERIN/SEROUT, under STR, I believe it is used to say how many characters to wait for, or what the end character should be.

    It's not really an operator, more a special character in some commands.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-29 16:17
    As Allan points out, the backslash character is not used as an operator in PBASIC; it's a delimiter that gets used where a comma would cause confusion. It gets used in SERIN and SEROUT when a flow control pin is used; it is more frequently used in SHIFTIN and SHIFTOUT to specify the number of bits to receive or transmit; similarly, it can be used with the REP modifier in serial functions to specify the number of characters to repeat; and as you point out, it can be used in I2CIN and I2COUT commands when the desitation address requires two bytes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office


    Post Edited (Jon Williams) : 12/29/2004 4:21:01 PM GMT
  • TinkerTinker Posts: 12
    edited 2004-12-29 16:18
    Thanks Allan..The example in the new Basic manual shows the following statement:
    " I2COut SDA, $A0 | block, addr, [noparse][[/noparse]REP value\16]". value is type, byte. addr is WORD, and block is type, Nib.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Two roads diverged in a wood and I..I tooked the one less traveled by.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-29 16:21
    In the statement, the REP (repeat) modifier will cause whatever is in value to be written 16 times.· I2COUT is one of many serial output functions that can use modifiers like REP, BIN, DEC, HEX, etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • TinkerTinker Posts: 12
    edited 2004-12-29 16:24
    Thanks Jon...I see why it is difficult to document its meaning...if the meaning changes depending on the context.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Two roads diverged in a wood and I..I tooked the one less traveled by.
Sign In or Register to comment.