Shop OBEX P1 Docs P2 Docs Learn Events
serin command — Parallax Forums

serin command

ArchiverArchiver Posts: 46,084
edited 2000-12-05 17:36 in General Discussion
I'm having a little problem but I cant seem to think straight at the
moment. Anyway I have this line of code in a program

SERIN 16,B96,("G")

when I use the syntax check, it always says

Error: expected ','

but in the BS2 manual it has this example

SERIN 0,N2400,("A")

I've never used this command before so I would like to know if it is
just me or is it the editor. What is wrong with it? Please tell me
how to correct it.

Andy

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-12-05 12:37
    At 11:41 AM Tuesday 12/5/2000 +0000, you wrote:
    >I'm having a little problem but I cant seem to think straight at the
    >moment. Anyway I have this line of code in a program
    >
    >SERIN 16,B96,("G")
    >
    >when I use the syntax check, it always says
    >
    >Error: expected ','
    >
    >but in the BS2 manual it has this example
    >
    >SERIN 0,N2400,("A")
    >
    >I've never used this command before so I would like to know if it is
    >just me or is it the editor. What is wrong with it? Please tell me
    >how to correct it.

    The SERIN command requires the following, per the PBASIC Stamp Manual:

    For the BS-1 Stamp -

    SERIN pin,baudmode,(qualifier,qualifier,...)
    SERIN pin,baudmode,{#}variable,{#}variable,...
    SERIN pin, baudmode, (qualifier,qualifier,...), {#}variable,
    {#}variable,...

    Per the Manual "Pin is a variable/constant (0–7) that specifies the I/O pin
    to use." so 16 is an INVALID pin number for the Stamp BS-1.

    In all case the BAUDMODE parameter is REQUIRED. ONLY the BAUDMODES AND
    SYMBOLS as found in the table below are VALID for the Stamp BS-1 :

    # Symbol Baud Rate Polarity

    0 T2400 2400 true

    1 T1200 1200 true

    2 T600 600 true

    3 T300 300 true

    4 N2400 2400 inverted

    5 N1200 1200 inverted

    6 N600 600 inverted

    7 N300 300 inverted

    So B96 is NOT a valid parameter for the Stamp BS-1, NOR is Port pin number 16.

    For the BS-2 Stamp -

    If you are using a Stamp BS-2 the BAUDMODE parameter can be expressed as a
    variable, and the format is:


    SERIN rpin{\fpin},baudmode,{plabel,}{timeout,tlabel,}[noparse][[/noparse]inputData]

    In this case B96 might be valid, if the syntax had been correct.

    SERIN 16,B96,("G") is a copy of your example
    | | |
    | | -- |< -- ambiguous use of a constant
    | |
    |
    |< -- incorrect bracket
    |
    |<
    undefined symbol (at present)

    So I trust that will give you a start.

    Knowing whether the statement was destined for a BS-1 or a BS-2 would be
    MOST helpful.

    Regards,

    Bruce Bates



    >Andy
  • ArchiverArchiver Posts: 46,084
    edited 2000-12-05 14:38
    Could it be that you need [noparse][[/noparse]"G"] instead of ("G")
    As well as the i/o No 16 being incorrect.
    Chris
    Original Message
    From: Bruce Bates <bvbates@u...>
    To: <basicstamps@egroups.com>
    Sent: Tuesday, December 05, 2000 8:37 PM
    Subject: Re: [noparse][[/noparse]basicstamps] serin command


    > At 11:41 AM Tuesday 12/5/2000 +0000, you wrote:
    > >I'm having a little problem but I cant seem to think straight at the
    > >moment. Anyway I have this line of code in a program
    > >
    > >SERIN 16,B96,("G")
    > >
    > >when I use the syntax check, it always says
    > >
    > >Error: expected ','
    > >
    > >but in the BS2 manual it has this example
    > >
    > >SERIN 0,N2400,("A")
    > >
    > >I've never used this command before so I would like to know if it is
    > >just me or is it the editor. What is wrong with it? Please tell me
    > >how to correct it.
    >
    > The SERIN command requires the following, per the PBASIC Stamp Manual:
    >
    > For the BS-1 Stamp -
    >
    > SERIN pin,baudmode,(qualifier,qualifier,...)
    > SERIN pin,baudmode,{#}variable,{#}variable,...
    > SERIN pin, baudmode, (qualifier,qualifier,...), {#}variable,
    > {#}variable,...
    >
    > Per the Manual "Pin is a variable/constant (0-7) that specifies the I/O
    pin
    > to use." so 16 is an INVALID pin number for the Stamp BS-1.
    >
    > In all case the BAUDMODE parameter is REQUIRED. ONLY the BAUDMODES AND
    > SYMBOLS as found in the table below are VALID for the Stamp BS-1 :
    >
    > # Symbol Baud Rate Polarity
    >
    > 0 T2400 2400 true
    >
    > 1 T1200 1200 true
    >
    > 2 T600 600 true
    >
    > 3 T300 300 true
    >
    > 4 N2400 2400 inverted
    >
    > 5 N1200 1200 inverted
    >
    > 6 N600 600 inverted
    >
    > 7 N300 300 inverted
    >
    > So B96 is NOT a valid parameter for the Stamp BS-1, NOR is Port pin number
    16.
    >
    > For the BS-2 Stamp -
    >
    > If you are using a Stamp BS-2 the BAUDMODE parameter can be expressed as a
    > variable, and the format is:
    >
    >
    > SERIN rpin{\fpin},baudmode,{plabel,}{timeout,tlabel,}[noparse][[/noparse]inputData]
    >
    > In this case B96 might be valid, if the syntax had been correct.
    >
    > SERIN 16,B96,("G") is a copy of your example
    > | | |
    > | | -- |< -- ambiguous use of a constant
    > | |
    > |
    |< -- incorrect bracket
    > |
    >
    |<
    undefined symbol (at present)
    >
    > So I trust that will give you a start.
    >
    > Knowing whether the statement was destined for a BS-1 or a BS-2 would be
    > MOST helpful.
    >
    > Regards,
    >
    > Bruce Bates
    >
    >
    >
    > >Andy
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-12-05 17:36
    Andy,
    Check a little closer an you'll find that the example shows SERIN
    0,N2400,[noparse][[/noparse]"A"]. You used parentheses instead of brackets. I never understood
    why brackets [noparse][[/noparse] ] were chosen. I guess I'm just glad they didn't choose
    braces { } .

    Mike


    At 11:41 AM 12/5/2000 +0000, you wrote:
    >I'm having a little problem but I cant seem to think straight at the
    >moment. Anyway I have this line of code in a program
    >
    >SERIN 16,B96,("G")
    >
    >when I use the syntax check, it always says
    >
    >Error: expected ','
    >
    >but in the BS2 manual it has this example
    >
    >SERIN 0,N2400,("A")
    >
    >I've never used this command before so I would like to know if it is
    >just me or is it the editor. What is wrong with it? Please tell me
    >how to correct it.
    >
    >Andy

    _________________________________
    Mike Walsh
    walsh@i...
    California Institute of Technology
    Biology Electronics Shop
    MS 216-76
    Pasadena, CA 91125

    626-395-6825 , FAX 626-584-1654
    237 Beckman Behavioral Biology Bldg.
Sign In or Register to comment.