List Info

Thread: Re: rs232 bash acquisition




Re: rs232 bash acquisition
country flaguser name
United States
2008-03-28 11:51:07

if i try to send data to 115200 baud rate from hyperterm your code work
but if i connect directly on com1 a magnetometer with stream data
continuosly at 9600 baud don't save nothing .
why ?
ive set so the ttyS0:
stty -F /dev/ttyS0 9600
but don't work can u help me ?

another question AM0 -- AM1 -- AM2 are always serial port ?
--- In ts-7000%40yahoogroups.com">ts-7000yahoogroups.com, "Andy Mercier&quot; <andynmercier...> wrote:
&gt;
> If you don't need to use "variable" maybe consider skipping the data
>; going through bash and allowing *nix power to do the work for you:
>;
> cat /dev/ttyS0 >>file.txt
&gt;
> It meets your criteria of working from within the bash shell.
&gt;
> If this doesn't work for you and you still need help please post the
> details of how you're configuring the serial port (with stty), which
&gt; TS product you're using, etc.
>;
> ----
>; Andy
>;
> --- In ts-7000%40yahoogroups.com">ts-7000yahoogroups.com, "e.pifferi" <e.pifferi> wrote:
&gt; >
>; > hy i need to acquire data from an item on ttyS0 and save this data on
> > a file.txt it's possible to do from bash shell ?
> >
> > ive tryed so :
> >
> > read variable < /dev/ttyS0 echo $variable >> file.txt
> >
> > or so
> >
> > export variable=`cat /dev/ttyS0 echo $variable >> file.txt
> >
> > but don't work can anyone help me
> >
>;

__._,_.___
.

__,_._,___
Re: rs232 bash acquisition
country flaguser name
United States
2008-03-28 12:12:47

Try:
stty -F /dev/ttyS0 9600 raw -echo

When you're running the code with the magnetometer.

Please provide some reference to the magnetometer or post the
information about it's data steam as it is documented (if it is
documented). You'll need some line ending or file ending to occur for
the code using cat to work, long-term.

Now that you've seen it work, you may have to consider writing code
that opens the serial port and works with it directly so that you can
implement timeouts if characters don't arrive, for example (the cable
disconnects). For that kind of coding it's best you read the HOWTO for
serial communications programming, search of Google today shows:
http://tldp.org/HOWTO/Serial-Programming-HOWTO/index.html
http://www.faqs.org/docs/Linux-HOWTO/Serial-Programming-HOWTO.html

We can give you a more complete answer but you're "spoon feeding&quot; some
information so we'll try again.

Just so I don't miss anything in trying to help... Which TS board are
you running? If, for no other reason, naming you product will help
when someone searches the group for specific problems on specific
products.

----
Andy

--- In ts-7000%40yahoogroups.com">ts-7000yahoogroups.com, "e.pifferi" <e.pifferi...> wrote:
&gt;
> if i try to send data to 115200 baud rate from hyperterm your code
>; work
> but if i connect directly on com1 a magnetometer with stream data
>; continuosly at 9600 baud don't save nothing .
> why ?
> ive set so the ttyS0:
&gt; stty -F /dev/ttyS0 9600
>; but don't work can u help me ?
>
> another question AM0 -- AM1 -- AM2 are always serial port ?
> --- In ts-7000%40yahoogroups.com">ts-7000yahoogroups.com, "Andy Mercier&quot; <andynmercier> wrote:
&gt; >
>; > If you don't need to use "variable" maybe consider skipping the data
>; > going through bash and allowing *nix power to do the work for you:
>; >
> > cat /dev/ttyS0 >>file.txt
&gt; >
> > It meets your criteria of working from within the bash shell.
&gt; >
> > If this doesn't work for you and you still need help please post the
> > details of how you're configuring the serial port (with stty), which
&gt; > TS product you're using, etc.
>; >
> > ----
>; > Andy
>; >
> > --- In ts-7000%40yahoogroups.com">ts-7000yahoogroups.com, "e.pifferi" <e.pifferi> wrote:
&gt; > >
>; > > hy i need to acquire data from an item on ttyS0 and save this
data on
> > > a file.txt it's possible to do from bash shell ?
> > >
> > > ive tryed so :
> > >
> > > read variable < /dev/ttyS0 echo $variable >> file.txt
> > >
> > > or so
> > >
> > > export variable=`cat /dev/ttyS0 echo $variable >> file.txt
> > >
> > > but don't work can anyone help me
> > >
>; >
>;

__._,_.___
.

__,_._,___
Re: rs232 bash acquisition
country flaguser name
United States
2008-03-28 12:40:50

--- In ts-7000%40yahoogroups.com">ts-7000yahoogroups.com, "e.pifferi" <e.pifferi...> wrote:
&gt;
> if i try to send data to 115200 baud rate from hyperterm your code work
> but if i connect directly on com1 a magnetometer with stream data
>; continuosly at 9600 baud don't save nothing .
> why ?
> ive set so the ttyS0:
&gt; stty -F /dev/ttyS0 9600
>; but don't work can u help me ?
>
> another question AM0 -- AM1 -- AM2 are always serial port ?
> --- In ts-7000%40yahoogroups.com">ts-7000yahoogroups.com, "Andy Mercier&quot; <andynmercier> wrote:
&gt; >
>; > If you don't need to use "variable" maybe consider skipping the data
>; > going through bash and allowing *nix power to do the work for you:
>; >
> > cat /dev/ttyS0 >>file.txt
&gt; >
> > It meets your criteria of working from within the bash shell.
&gt; >
> > If this doesn't work for you and you still need help please post the
> > details of how you're configuring the serial port (with stty), which
&gt; > TS product you're using, etc.
>; >
> > ----
>; > Andy
>; >
> > --- In ts-7000%40yahoogroups.com">ts-7000yahoogroups.com, "e.pifferi" <e.pifferi> wrote:
&gt; > >
>; > > hy i need to acquire data from an item on ttyS0 and save this
data on
> > > a file.txt it's possible to do from bash shell ?
> > >
> > > ive tryed so :
> > >
> > > read variable < /dev/ttyS0 echo $variable >> file.txt
> > >
> > > or so
> > >
> > > export variable=`cat /dev/ttyS0 echo $variable >> file.txt
> > >
> > > but don't work can anyone help me

Hi --

The thread archived here:
http://tech.groups.yahoo.com/group/ts-7000/message/5678
has many helpful solutions to this very problem, from simple shell
commands to full-blown monitoring & logging programs.

Regards, ......... Charlie

> > >
>; >
>;

__._,_.___
.

__,_._,___
Re: Re: rs232 bash acquisition
country flaguser name
Australia
2008-03-28 17:47:35

On Fri, Mar 28, 2008 at 04:51:07PM -0000, e.pifferi wrote:
&gt; if i try to send data to 115200 baud rate from hyperterm your code work
> but if i connect directly on com1 a magnetometer with stream data
>; continuosly at 9600 baud don't save nothing .
> why ?
> ive set so the ttyS0:
&gt; stty -F /dev/ttyS0 9600
>; but don't work can u help me ?

The speed of ttyS0 might revert when it close, try:
(stty ispeed 9600;sed 5q) </dev/ttyS0

Andrew

__._,_.___
.

__,_._,___
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )