Shop OBEX P1 Docs P2 Docs Learn Events
help on SERIN/SEROUT — Parallax Forums

help on SERIN/SEROUT

ArchiverArchiver Posts: 46,084
edited 2003-01-28 00:10 in General Discussion
Hi All,

I'm quite a newbie in BasicStamp stuff.
At the moment I'm able to control all the functions I need for my
experiments, except the serial comms using serin/serout.

I'm using a BS2p (and also a bs2p 40 pin), and I've tried everything
to control basic I/O, without success.

Is there someone that can give a little help?

Below is a simple example that I'm not able to control:
'{$STAMP BS2p}

char var byte

debug cls

loop:
debug CR, "Ok" , CR
serin 16,18447,[noparse][[/noparse]char] 'recebe um caracter
serout 16,18447, [noparse][[/noparse]char] 'transmite o caracter
goto loop

it is suposed that for each char I sent (using debug terminal window),
it will be sent back, together with a CR and an "OK" prompt, right?

Well, it doesn't work...

I've already tried with and without ATN pin connected, and started at
9600bps, down to 1200bps.

Also tried INVERTED and Non INVERTED, without success.

I would appreciate your kind help.

Regards,

Paulo

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-01-26 22:54
    In a message dated 01/26/2003 17:38:52 Eastern Standard Time,
    jpcarvalhal@m... writes:


    > char var byte
    >
    > debug cls
    >
    > loop:
    > debug CR, "Ok" , CR
    > serin 16,18447,[noparse][[/noparse]char] 'recebe um caracter
    > serout 16,18447, [noparse][[/noparse]char] 'transmite o caracter
    > goto loop
    >

    You are going to fast. Put a pause 1000 after the serout and then you will
    be able to see it.

    Sid Weaver
    W4EKQ
    Port Richey, FL


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-26 23:08
    I see a couple of problems.. First off the pin you have assigned is on the
    aux set of pins, you need to tell the device to use them..."AUXIO" is the
    command to switch to tose pins...

    The next problem is you never tell DEBUG to display the data U inout or
    output..

    Try this:

    '{$STAMP BS2p}
    >
    > char var byte
    >
    > debug cls
    > auxio
    > loop:
    > debug CR, "Ok" , CR
    > serin 16,18447,[noparse][[/noparse]char] 'recebe um caracter
    Debug str(char)
    > serout 16,18447, [noparse][[/noparse]char] 'transmite o caracter
    > goto loop

    ALso, if the data is messed up try using 2063 as the baudmode incase your
    device is sending that instead of inverted..

    Mike B.
    Original Message
    From: <jpcarvalhal@m...>
    To: <basicstamps@yahoogroups.com>
    Sent: Sunday, January 26, 2003 2:37 PM
    Subject: [noparse][[/noparse]basicstamps] help on SERIN/SEROUT


    > Hi All,
    >
    > I'm quite a newbie in BasicStamp stuff.
    > At the moment I'm able to control all the functions I need for my
    > experiments, except the serial comms using serin/serout.
    >
    > I'm using a BS2p (and also a bs2p 40 pin), and I've tried everything
    > to control basic I/O, without success.
    >
    > Is there someone that can give a little help?
    >
    > Below is a simple example that I'm not able to control:
    >
    > '{$STAMP BS2p}
    >
    > char var byte
    >
    > debug cls
    >
    > loop:
    > debug CR, "Ok" , CR
    > serin 16,18447,[noparse][[/noparse]char] 'recebe um caracter
    > serout 16,18447, [noparse][[/noparse]char] 'transmite o caracter
    > goto loop
    >
    >
    > it is suposed that for each char I sent (using debug terminal window),
    > it will be sent back, together with a CR and an "OK" prompt, right?
    >
    > Well, it doesn't work...
    >
    > I've already tried with and without ATN pin connected, and started at
    > 9600bps, down to 1200bps.
    >
    > Also tried INVERTED and Non INVERTED, without success.
    >
    > I would appreciate your kind help.
    >
    > Regards,
    >
    > Paulo
    >
    >
    > 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-01-27 01:03
    Paulo-

    DEBUG statements send data to your PC at 9600 baud, 8 bits, no
    parity, inverted. You should do the same when SEROUT or SERIN to or
    from I/O 16, since that is what the DEBUG window typically expects.
    Try baud value 16624 for the '2p.

    You could help yourself by inserting

    DEBUG CR, char

    after your SERIN statement to verify what your Stamp received and
    that execution has reached that point.

    Regards,

    Steve
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-27 08:28
    There is another point beside all the others: you use port 16
    which is fixed to 9600 bits/s, 8 bits, no parity, 1 stop bit.
    No matter what you try to set up with serin/serout the physical
    parameters of port 16 remain the same.

    Someone states that you should switch to AUXIO - well that is not
    the point, port 16 corresponds to Rx/Tx, no matter whether after
    AUXIO or MAINIO.

    Regards
    Adrian
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-27 12:32
    Are you getting interference from the airports radar? (that would be a ZING
    sound every ten seconds or so)
    That's a damn hard one to beat, it gets in to EVERYTHING!!
    Original Message
    From: <adrian.schneider@t...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, January 27, 2003 7:28 PM
    Subject: [noparse][[/noparse]basicstamps] Re: help on SERIN/SEROUT


    > There is another point beside all the others: you use port 16
    > which is fixed to 9600 bits/s, 8 bits, no parity, 1 stop bit.
    > No matter what you try to set up with serin/serout the physical
    > parameters of port 16 remain the same.
    >
    > Someone states that you should switch to AUXIO - well that is not
    > the point, port 16 corresponds to Rx/Tx, no matter whether after
    > AUXIO or MAINIO.
    >
    > Regards
    > Adrian
    >
    >
    > 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-01-28 00:08
    Steve,

    Thank you for your help.
    After a lot of unsuccessfull tests I messed up everything.

    It's working!!! Yes!

    Regards

    Paulo

    Mensagem original
    De: S Parkis [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=0bo4A5EkPTZ1GJ8CILQVuwmd39lbZXOkj6ALFJ4XN_5o9tkVxPo-u9F4nCQ_ISl8NFN7FdlEvLgpS6gp_8c]parkiss@e...[/url
    Enviada: segunda-feira, 27 de Janeiro de 2003 1:04
    Para: basicstamps@yahoogroups.com
    Assunto: Re: [noparse][[/noparse]basicstamps] help on SERIN/SEROUT


    Paulo-

    DEBUG statements send data to your PC at 9600 baud, 8 bits, no
    parity, inverted. You should do the same when SEROUT or SERIN to or
    from I/O 16, since that is what the DEBUG window typically expects.
    Try baud value 16624 for the '2p.

    You could help yourself by inserting

    DEBUG CR, char

    after your SERIN statement to verify what your Stamp received and
    that execution has reached that point.

    Regards,

    Steve


    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-01-28 00:10
    Adrian,

    Among other things I was trying to use port 16 with a baud diferent from
    9600...
    It's cool now!
    Thank you.
    Regards,

    Paulo

    Mensagem original
    De: Adrian Schneider <adrian.schneider@t...>
    [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=jN_tzdALOGE_JQmiSU8nMZf261oSmd4xV4EZnplR1b7CKe6tryMhCnynXzfGhEXPwyFuwjZFUGJLy2RSW2SpNMpxFmSG]adrian.schneider@t...[/url
    Enviada: segunda-feira, 27 de Janeiro de 2003 8:28
    Para: basicstamps@yahoogroups.com
    Assunto: [noparse][[/noparse]basicstamps] Re: help on SERIN/SEROUT


    There is another point beside all the others: you use port 16
    which is fixed to 9600 bits/s, 8 bits, no parity, 1 stop bit.
    No matter what you try to set up with serin/serout the physical
    parameters of port 16 remain the same.

    Someone states that you should switch to AUXIO - well that is not
    the point, port 16 corresponds to Rx/Tx, no matter whether after
    AUXIO or MAINIO.

    Regards
    Adrian


    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-01-28 00:10
    No airports nearby.
    Anyway I think I was ready to evaluate the probability of interference from
    the microwave oven next door!

    Thank you Dwain.
    Regards,

    PAulo

    Mensagem original
    De: Dwain J. Hill [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Z7ro3lAbB279FWI-yF9Y0se7HZDV4fWqFwatTD6e0552lF6VlThVP3w1zMThqTZm7ObrjvrkZjkLX6T3QGlEmwY]dwainsworld@e...[/url
    Enviada: segunda-feira, 27 de Janeiro de 2003 12:33
    Para: basicstamps@yahoogroups.com
    Assunto: Re: [noparse][[/noparse]basicstamps] Re: help on SERIN/SEROUT


    Are you getting interference from the airports radar? (that would be a ZING
    sound every ten seconds or so)
    That's a damn hard one to beat, it gets in to EVERYTHING!!
    Original Message
    From: <adrian.schneider@t...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, January 27, 2003 7:28 PM
    Subject: [noparse][[/noparse]basicstamps] Re: help on SERIN/SEROUT


    > There is another point beside all the others: you use port 16
    > which is fixed to 9600 bits/s, 8 bits, no parity, 1 stop bit.
    > No matter what you try to set up with serin/serout the physical
    > parameters of port 16 remain the same.
    >
    > Someone states that you should switch to AUXIO - well that is not
    > the point, port 16 corresponds to Rx/Tx, no matter whether after
    > AUXIO or MAINIO.
    >
    > Regards
    > Adrian
    >
    >
    > 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/
    >
    >
    >
    >



    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/
Sign In or Register to comment.