--- In "jeffwebbuk1" <> wrote:
>
> Hi all,
>
> First up, I'm a novice when it comes to UART stuff so please be kind :)
>
> I've been developing on a TS-7550. I've connected the rs232 to an external
> controller. By running the following:
>
> xuartctl --port=0 --speed=9600
>
> I can manually type the letter 'a', for example, hit return and the
> controller sends a nice big string back to the screen like :xyz123;
>
> But what I really want to do is have a simple shell script that sends 'a' to
> port 0 every x seconds, and when it gets the string back it assigns it to a
> variable for use by other functions.
>
> I've read all the manuals and scoured the net, but even why I try the
> suggested test of something like:
>
> echo "hello world" > /dev/pts/0
>
> it doesn't actually do anything :(
>
> Could anyone possibly point me in the right direction as it's the very last
> bit of the puzzle to make my whole fun project work!
>
> Thanks in advance to anyone who can help me with this :)
The xuartctl line as you have it sets up so that standard input is sent to the
port and conversely bytes read from the serial port are sent to standard
output. That's fine for interactive use but not for a shell script.
You will probably need to add the --server option which makes the xuartctl
program daemonise itself and creates a /dev/pts/XX device for you to read to
and write from.
The tricky thing is guaranteeing what device has been created. If you have
made one or more telnet connection to the board, that will start to create
/dev/pts entries as well.
I don't think shell script is the best way to handle serial I/O, I am afraid.
It would be really nice to use Python and its serial libraries, but building
that lot has got to be a major job.
All my serial handling is one from C - where you do at least have complete
control.
In your project you will have to handle timeouts to decide when you have got a
complete string back. Unless you can find an equivalent to 'read' which
accepts a timeout parameter.
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|