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

serin

ArchiverArchiver Posts: 46,084
edited 2004-06-04 05:44 in General Discussion
Hi there!

I cannot read BASIC but JAVA, so I have this problem:
What does this command mean?

serin 10,164864,200,noecho1,[noparse][[/noparse]echo]

10 is clear to me (its the receiver pin), but the rest?

Thanks a lot!
Best regards,
Roland.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-10-31 12:10
    On Thu, 2002-10-31 at 03:13, roland wrote:
    > I cannot read BASIC but JAVA, so I have this problem:
    > What does this command mean?
    >
    > serin 10,164864,200,noecho1,[noparse][[/noparse]echo]
    10 would be the pin the SERIN statement is attached to.
    164864 is the baudmode, although this is an invalid number (valid range
    0-65535)

    200 would be the timeout value (ie: if no data is received in this
    time..)

    noecho1 in this case is associated with the 200, if no data is received
    before the timeout, the program will jump to the noecho1: subroutine

    [noparse][[/noparse]echo] is the data you're looking for, and other instructions and
    qualifiers for the incoming data, this would more often be something
    like:

    [noparse][[/noparse]DEC, Data] <- Convert incoming data to decimal numbers and store in
    Data variable

    [noparse][[/noparse]WAIT("TEMP:"),DEC Data] <- Wait for the string TEMP: to be received,
    converts the characters that follow into decimal numbers, and store in
    Data variable. Thus if it received, "TEMP:65F" you would end up with
    "65" in the Data variable ("F" is not a valid number in decimal, so the
    stamp would see the "F" and realize that all valid digits for this
    string have been received at that point)

    [noparse][[/noparse]WAIT ("DONE")] <- Will wait for the word "DONE" (up until timeout, or
    forever if no timeout is specified) before program execution continues

    [noparse][[/noparse]STR Data\8\"F"] < - Store the first 8 bytes of incoming data as a
    string in variable Data (Data variable must be at least 8 bytes long ie:
    "Data VAR BYTE(8)" ), *or* store incoming data in variable Data if an F
    is detected before 8 bytes of data have been received (ie: "TEMP:5F" is
    received, which is only 7 bytes, the stamp sees the "F" as the end
    character and completes the operation, even though a full 8 bytes was
    not received )

    Hope that helps, it's kinda off the cuff, and I've only had 1 cup of tea
    this morning, so I might've munged something slightly.
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-01 11:07
    Hi Brian!

    Thanks a lot!
    Yeah, that was a very good explanation! Thanks a lot!
    Best regards,
    Roland.
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 23:28
    Hi there!

    i have a question! i need to know if there is a way to timeout a
    serin command.
    Let me explain... here is my example:

    I want that the "serin" command only wait for a answer of a pc or
    other stamp, for 10seconds. After that it continues to the next
    procedure.

    code ex:
    [noparse][[/noparse]code]
    serin xx,yy,yy 'if there is no answer for 10sec, timeout
    [noparse][[/noparse]code]

    is that possible???

    i'm using BS1, but i'm waiting for all possibilities.

    thanks
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 23:30
    I cant tell you off of the top of my head, but the answer is in the serin
    section of the latest stamp manual. But yes, it can easily be done.


    Original Message
    From: <jmsdweb@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Tuesday, February 11, 2003 7:28 AM
    Subject: [noparse][[/noparse]basicstamps] Serin


    > Hi there!
    >
    > i have a question! i need to know if there is a way to timeout a
    > serin command.
    > Let me explain... here is my example:
    >
    > I want that the "serin" command only wait for a answer of a pc or
    > other stamp, for 10seconds. After that it continues to the next
    > procedure.
    >
    > code ex:
    > [noparse][[/noparse]code]
    > serin xx,yy,yy 'if there is no answer for 10sec, timeout
    > [noparse][[/noparse]code]
    >
    > is that possible???
    >
    > i'm using BS1, but i'm waiting for all possibilities.
    >
    > thanks
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 23:39
    thanks....

    i already search in the serin section... i gona see it again.

    you know... my english is not so good... i'm portuguese...

    but once again, thanks
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 23:47
    yes! i found it!

    "using serial time-out feature"

    is that possible for SB1 or, another way to do that?


    but, you was a real help. past 10 min i haved posted my message, you
    have answered. THANK YOU
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 23:53
    Timeouts with SERIN are only possible with the BS2 family. This feature is
    not available on the BS1.

    -- Jon Williams
    -- Parallax

    In a message dated 2/10/2003 5:49:09 PM Central Standard Time,
    jmsdweb@y... writes:

    > yes! i found it!
    >
    > "using serial time-out feature"
    >
    > is that possible for SB1 or, another way to do that?



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-13 21:20
    Hello,

    I am trying to implement SERIN and some if loops together with BS
    1. If I put SERIN some where in the program then the other commands
    are excuting only when I recieve some thing otherwise it is hanging
    on SERIN. BS 2 has timeout function, but I am trying with BS 1.
    Please help me in this regard if you have any ideas

    advanced thanks

    Krishna Palle
  • ArchiverArchiver Posts: 46,084
    edited 2004-03-22 02:02
    I'm using SERIN to retrieve a set of numbers from a string that
    looks like this (ex. 25a123a45a9...) 'a' seperates the numbers

    The following syntax works : SERIN 16, 240, [noparse][[/noparse]DEC x, DEC y]. The
    result would be x=25, y=123.
    The problem is that for strings containing many and/or varying
    amount of numbers, I would need some logic. I wasn't able to embed a
    for loop in the serin command - it gave me syntax errors; assuming
    you know the number of numbers in the incoming string, does anyone
    have any ideas on how to capture all the numbers to different
    variables ?

    Thanks, Arie
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-29 09:39
    In a message dated 5/29/2004 5:16:25 AM Eastern Daylight Time,
    robert.bohlin@b... writes:


    > I am wondering if there is another way for the stamp to wait for a
    > command from another program like serin.
    >
    > I want to read the temperature and while doing that i want the stamp
    > to wait for a command...
    > if no command then read temperature
    > if command then do somthing
    >
    >

    Try this, Robert

    start:
    serin pin, baud, 1000, readit, [noparse][[/noparse]"Do something"]

    'Stamp will wait 1 second then jump to readit

    readit:
    (Read temp)
    pause 100
    goto start

    Does this help?

    Sid


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-29 10:15
    HI!

    I am wondering if there is another way for the stamp to wait for a
    command from another program like serin.

    I want to read the temperature and while doing that i want the stamp
    to wait for a command...
    if no command then read temperature
    if command then do somthing

    regards
    robert
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-29 15:09
    In addition to Sid's suggestion, you could use flow controlled serial to
    alert your "master" device that you're ready for a command. The article
    below shows how to use flow control with an external device:

    http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv89.pdf

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


    Original Message
    From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=KDWKlpQ57oET7k8Nvo7YMToHrYsF7L316RybnLbmUsCAGT5qEMIRQy6-vCnft6XECZ2NRw]Newzed@a...[/url
    Sent: Saturday, May 29, 2004 7:39 AM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Serin


    In a message dated 5/29/2004 5:16:25 AM Eastern Daylight Time,
    robert.bohlin@b... writes:


    > I am wondering if there is another way for the stamp to wait for a
    > command from another program like serin.
    >
    > I want to read the temperature and while doing that i want the stamp
    > to wait for a command...
    > if no command then read temperature
    > if command then do somthing
    >
    >

    Try this, Robert

    start:
    serin pin, baud, 1000, readit, [noparse][[/noparse]"Do something"]

    'Stamp will wait 1 second then jump to readit

    readit:
    (Read temp)
    pause 100
    goto start

    Does this help?

    Sid
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-03 23:18
    does serin read bits starting from the "most significant bit" forward
    or from the "least significant bit" backward?
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-04 02:37
    The best short tutorial on this is:
    http://www.rentron.com/Myke7.htm

    To summarize: 232 starts 'idle' high. It then sends
    a 'start_bit' for one bit time LOW. It then sends the
    Least Significant Bit for one bit time -- and so forth,
    to the MSBit. It then holds HIGH for one bit time,
    before the next start bit can be seen.

    So, it sends LSB to MSB.

    --- In basicstamps@yahoogroups.com, "Green One" <greenish_green@y...>
    wrote:
    > does serin read bits starting from the "most significant bit"
    forward
    > or from the "least significant bit" backward?
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-04 05:44
    Serial data appropriate for SERIN is transmitted LSb first.

    Regards,

    Steve

    On 3 Jun 04 at 22:18, Green One wrote:

    > does serin read bits starting from the "most significant bit"
    > forward or from the "least significant bit" backward?
Sign In or Register to comment.