comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Sending data to the serial port (Linux)?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Sending data to the serial port (Linux)? [message #37528] Tue, 06 January 2004 04:04 Go to next message
Pepijn Kenter is currently offline  Pepijn Kenter
Messages: 31
Registered: April 2002
Member
Olaf Stetzer wrote:
> Hello and a nice new year!
>
> Is there an easy way to send data to the serial port
> under Linux? I have some values in a spreadsheet that
> need to be reformatted and sent to e.g. /dev/ttyS0.
> I think of exporting the spreadsheet as csv and read it
> into IDL, reformatting is easy and no problem but how
> do I send the strings to the serial interface? Probably by
> writing to another file and doing a 'cat foobar /dev/ttyS0'?
> Is the latter possible in the timed demo mode (I need
> to to this at home without access to our license server).
>

Can't you just open the device in IDL with the openw procedure?
Like so:

openw, lun, '/dev/ttyS0', /get_lun
printf, lun, "test string"
free_lun, lun

Since 'everything is a file' in linux this should work.

> There is probably an easy solution without using IDL
> any hints?) but IDL is the only language I have a
> good pragramming experience with! :-)
>

If you want the right tool for the right job, awk is probably what
you're looking for.

HTH, Pepijn Kenter.
Re: Sending data to the serial port (Linux)? [message #37618 is a reply to message #37528] Wed, 07 January 2004 06:25 Go to previous message
Olaf Stetzer is currently offline  Olaf Stetzer
Messages: 39
Registered: September 2001
Member
Pepijn Kenter schrieb:
> Olaf Stetzer wrote:
>
>> Hello and a nice new year!
>>
>> Is there an easy way to send data to the serial port
>> under Linux? I have some values in a spreadsheet that
>> need to be reformatted and sent to e.g. /dev/ttyS0.
>> I think of exporting the spreadsheet as csv and read it
>> into IDL, reformatting is easy and no problem but how
>> do I send the strings to the serial interface? Probably by
>> writing to another file and doing a 'cat foobar /dev/ttyS0'?
>> Is the latter possible in the timed demo mode (I need
>> to to this at home without access to our license server).
>>
>
> Can't you just open the device in IDL with the openw procedure?
> Like so:
>
> openw, lun, '/dev/ttyS0', /get_lun
> printf, lun, "test string"
> free_lun, lun
>
> Since 'everything is a file' in linux this should work.
>
>> There is probably an easy solution without using IDL
>> any hints?) but IDL is the only language I have a
>> good pragramming experience with! :-)
>>
>
> If you want the right tool for the right job, awk is probably what
> you're looking for.

Yes I solved it with awk yesterday. I still have to try if
cat foobar /dev/ttyS0 does the right thing, I will try that
this evening. Will perl be an easy alternative if this simple
solution fails?

Olaf
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Widgets: group leader and procedures
Next Topic: 2 little questions: (Object windows with widget_draw) AND (geting working directory)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:46:22 PDT 2025

Total time taken to generate the page: 0.00475 seconds