Sending data to the serial port (Linux)? [message #37529] |
Tue, 06 January 2004 03:14  |
Olaf Stetzer
Messages: 39 Registered: September 2001
|
Member |
|
|
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).
If anybody is curious: The data are the program steps
for a slide show that should be presented with a
programmable slide projector (Rollei Twin MSC325P).
There is probably an easy solution without using IDL
any hints?) but IDL is the only language I have a
good pragramming experience with! :-)
Thanks,
Olaf
|
|
|
Re: Sending data to the serial port (Linux)? [message #37608 is a reply to message #37529] |
Wed, 07 January 2004 15:03  |
Olaf Stetzer
Messages: 39 Registered: September 2001
|
Member |
|
|
Craig Markwardt wrote:
> Olaf Stetzer <olaf.stetzer@gmx.net> writes:
>
>> Pepijn Kenter wrote:
>
> [ ... ]
>
>>> Don't forget the '>' character:
>>> cat foobar > /dev/ttyS0
>>
>> I just tried it and it works partly. Problem:
>> The projector echoes each character. The sender needs to wait until
>> the echo is there before sending the next char. I think that is not
>> possible with the above simple solution. I will try to learn some perl
>> to solve this... :-(
>
>
> And, what about Pepijn's original suggestion of opening the device
> file directly within IDL?
I know it gets off topic know, sorry. Since I have to do it at home
wihout IDL license I am bound to the timed demo mode in IDL. Is
writing to file permitted in this case? And, I am now close to
the solution of my problem using bash, awk and some perl code
(all done with merely any prior knowledege about these languages :-)
But thanks anyway to your suggestions,
Olaf
|
|
|
Re: Sending data to the serial port (Linux)? [message #37610 is a reply to message #37529] |
Wed, 07 January 2004 12:22  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Olaf Stetzer <olaf.stetzer@gmx.net> writes:
> Pepijn Kenter wrote:
[ ... ]
>> Don't forget the '>' character:
>> cat foobar > /dev/ttyS0
>
> I just tried it and it works partly. Problem:
> The projector echoes each character. The sender needs to wait until
> the echo is there before sending the next char. I think that is not
> possible with the above simple solution. I will try to learn some perl
> to solve this... :-(
And, what about Pepijn's original suggestion of opening the device
file directly within IDL?
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Sending data to the serial port (Linux)? [message #37611 is a reply to message #37529] |
Wed, 07 January 2004 10:44  |
Olaf Stetzer
Messages: 39 Registered: September 2001
|
Member |
|
|
Pepijn Kenter wrote:
>
>> 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?
>>
>
> Reformatting the data can also be done in perl but since you have solved
> that problem in awk, there is no need to use perl.
>
> Sending your formatted data to the serial port can be done in the (bash)
> shell. If you encounter problems (e.g. wrong file permissions) try to
> solve it from the shell; I don't think using perl will help you.
>
> Don't forget the '>' character:
> cat foobar > /dev/ttyS0
I just tried it and it works partly. Problem:
The projector echoes each character. The sender needs to wait until
the echo is there before sending the next char. I think that is not
possible with the above simple solution. I will try to learn some perl
to solve this... :-(
Olaf
|
|
|
Re: Sending data to the serial port (Linux)? [message #37614 is a reply to message #37529] |
Wed, 07 January 2004 07:32  |
Pepijn Kenter
Messages: 31 Registered: April 2002
|
Member |
|
|
> 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?
>
Reformatting the data can also be done in perl but since you have solved
that problem in awk, there is no need to use perl.
Sending your formatted data to the serial port can be done in the (bash)
shell. If you encounter problems (e.g. wrong file permissions) try to
solve it from the shell; I don't think using perl will help you.
Don't forget the '>' character:
cat foobar > /dev/ttyS0
Pepijn Kenter.
|
|
|