ts-7000
[Top] [All Lists]

[ts-7000] Re: A question on xuartctl - please help!

To:
Subject: [ts-7000] Re: A question on xuartctl - please help!
From: "jeffwebbuk1" <>
Date: Fri, 08 Jul 2011 10:47:07 -0000

--- In  "naturalwatt" <> wrote:
>
> 
> 
> --- In  "jeffwebbuk1" <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.
> 
> 
> >
>

Hi there,

Many thanks for your reply - Cracked it in the end, thanks to help from TS 
themselves :). Set a simple script to 'listen' for when /dev/pts/X changes, 
checks for the string length, and if correct assigns it to a temporary 
variable. Works like a charm.

I am using:

stty -F /dev/pts/0 raw # only need to do this once
read TEST < /dev/pts/0 # can then read the variable $TEST in rest of script.

I've had the script running every three seconds for almost a week now and it's 
behaving itself wonderfully.

Thanks again for your help and advice!








------------------------------------

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/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU