Shop OBEX P1 Docs P2 Docs Learn Events
Linux, the stamp and the serial port — Parallax Forums

Linux, the stamp and the serial port

ArchiverArchiver Posts: 46,084
edited 2003-07-07 07:35 in General Discussion
I have set up my basic stamp to monitor the input from serin ascii
text and based on the input, certain pins go high.

I am using linux as the machine communicating with the stamp. When I
use minicom and type the letter w the device works fine. However when
I try a command like


echo w >> /dev/ttyS0

it does not work.

I want to do this so that i do not have to go into another program
just to get the light to go on. If i can get the above line to work,
then script files will be a cinch.

Anyone have any ideas or leads. I tinkered with the stty util but i
was unsuccessful.

thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-07-04 12:28
    Hi

    You must configure the /dev/ttyS0 port characteristic (baud rate,
    handshaking, parity bit, ...) before you can use the serial port and
    send the first byte. This is what minicom do before sending the bytes to
    serial port.
    You also need write permission on /dev/ttyS0

    Note that "echo" also add a LF (line feed) at end of line

    Maybe you need a customized "echo" program or a small script file?

    Bye

    nestlerv wrote:
    >
    > I have set up my basic stamp to monitor the input from serin ascii
    > text and based on the input, certain pins go high.
    >
    > I am using linux as the machine communicating with the stamp. When I
    > use minicom and type the letter w the device works fine. However when
    > I try a command like
    >
    > echo w >> /dev/ttyS0
    >
    > it does not work.
    >
    > I want to do this so that i do not have to go into another program
    > just to get the light to go on. If i can get the above line to work,
    > then script files will be a cinch.
    >
    > Anyone have any ideas or leads. I tinkered with the stty util but i
    > was unsuccessful.
    >
    > thanks
    >

    --
    Arnaldo Braun
    Consultoria em inform
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-04 20:05
    Ok, but how would i do that, How can i set that? I tried with stty
    and it did not work. I am not sure how to set it to no handshake or
    no flow control.

    The line feed is not a problem. I can reprogram the stamp to expect
    the line feed right.

    Any ideas?




    --- In basicstamps@yahoogroups.com, Arnaldo Braun <abraun@t...> wrote:
    > Hi
    >
    > You must configure the /dev/ttyS0 port characteristic (baud rate,
    > handshaking, parity bit, ...) before you can use the serial port and
    > send the first byte. This is what minicom do before sending the
    bytes to
    > serial port.
    > You also need write permission on /dev/ttyS0
    >
    > Note that "echo" also add a LF (line feed) at end of line
    >
    > Maybe you need a customized "echo" program or a small script file?
    >
    > Bye
    >
    > nestlerv wrote:
    > >
    > > I have set up my basic stamp to monitor the input from serin ascii
    > > text and based on the input, certain pins go high.
    > >
    > > I am using linux as the machine communicating with the stamp.
    When I
    > > use minicom and type the letter w the device works fine. However
    when
    > > I try a command like
    > >
    > > echo w >> /dev/ttyS0
    > >
    > > it does not work.
    > >
    > > I want to do this so that i do not have to go into another program
    > > just to get the light to go on. If i can get the above line to
    work,
    > > then script files will be a cinch.
    > >
    > > Anyone have any ideas or leads. I tinkered with the stty util but
    i
    > > was unsuccessful.
    > >
    > > thanks
    > >
    >
    > --
    >
    > Arnaldo Braun
    > Consultoria em inform
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-04 22:44
    Hi

    For more information look at
    <http://www.easysw.com/~mike/serial/serial.html>
    and
    <ftp://sunsite.unc.edu:/pub/Linux/docs/HOWTO/Serial-Programming-HOWTO>

    If you know Delphi or Kylix (Pascal language) look
    <http://www.ararat.cz/synapse/> and download
    <http://www.ararat.cz/synapse/files/synaser.zip> it is a free syncronous
    serial library to make customized programs.


    Bye

    nestlerv wrote:
    >
    > Ok, but how would i do that, How can i set that? I tried with stty
    > and it did not work. I am not sure how to set it to no handshake or
    > no flow control.
    >
    > The line feed is not a problem. I can reprogram the stamp to expect
    > the line feed right.
    >
    > Any ideas?
    >

    Arnaldo Braun
    Consultoria em Inform
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-04 23:13
    Thanks, that might have the answer.



    --- In basicstamps@yahoogroups.com, Arnaldo Braun <abraun@t...> wrote:
    > Hi
    >
    > For more information look at
    > <http://www.easysw.com/~mike/serial/serial.html>
    > and
    > <ftp://sunsite.unc.edu:/pub/Linux/docs/HOWTO/Serial-Programming-
    HOWTO>
    >
    > If you know Delphi or Kylix (Pascal language) look
    > <http://www.ararat.cz/synapse/> and download
    > <http://www.ararat.cz/synapse/files/synaser.zip> it is a free
    syncronous
    > serial library to make customized programs.
    >
    >
    > Bye
    >
    > nestlerv wrote:
    > >
    > > Ok, but how would i do that, How can i set that? I tried with stty
    > > and it did not work. I am not sure how to set it to no handshake
    or
    > > no flow control.
    > >
    > > The line feed is not a problem. I can reprogram the stamp to
    expect
    > > the line feed right.
    > >
    > > Any ideas?
    > >
    >
    >
    > Arnaldo Braun
    > Consultoria em Inform
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-07 07:35
    Hi, try:

    stty -F /dev/ttyS0 9600 raw -echo -hupcl

    Regards
    Adrian
Sign In or Register to comment.