Advertisement

serial port programming

Started by September 26, 2005 12:55 PM
4 comments, last by miodragsm 19 years, 1 month ago
Hi, I am porting application from WinXp to Linux. It communicates with external device ( electrical power analyzer ) via serial port. Is there a way to set serial port that it sets RTS line to high when I am writing data to port and set it to low after writing is done? I can do it manually, but interval between write-end and RTS-to-low has to be fewer than 3ms. How to resolve this? (Using Linux, g++). Port settings are B9600, 8N1.
I don't know a sh*t about serial programming, but I can give
you some links:

http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/
http://www.tldp.org/HOWTO/Serial-HOWTO.html
http://www.easysw.com/~mike/serial/serial.html

Hope it was atleast somewhat helpfull :] .
Advertisement
3ms is quite heavy requirement in pre-emptive os. Deviations from that could be as high as 30ms under heavy load.

I guess you have to use RTAI or something similar in order to get lower jitter. RTAI basicly gives your program kernel priviledges and hard realtime scheduling.

Here's a simple RTAI program and here is a stroboscope implementation with RTAI.
Quote: Original post by Winograd
3ms is quite heavy requirement in pre-emptive os. Deviations from that could be as high as 30ms under heavy load.

I guess you have to use RTAI or something similar in order to get lower jitter. RTAI basicly gives your program kernel priviledges and hard realtime scheduling.

Here's a simple RTAI program and here is a stroboscope implementation with RTAI.


I'll give it a try, but if it's done in WinXP with only Win32 API i guess it should be possible with standard Linux libs

Quote: Original post by BBB
I don't know a sh*t about serial programming, but I can give
you some links:

http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/
http://www.tldp.org/HOWTO/Serial-HOWTO.html
http://www.easysw.com/~mike/serial/serial.html

Hope it was atleast somewhat helpfull :] .


Already tried that. Thanks.
Quote: Original post by miodragsm
Quote: Original post by Winograd
3ms is quite heavy requirement in pre-emptive os. Deviations from that could be as high as 30ms under heavy load.

I guess you have to use RTAI or something similar in order to get lower jitter. RTAI basicly gives your program kernel priviledges and hard realtime scheduling.

Here's a simple RTAI program and here is a stroboscope implementation with RTAI.


I'll give it a try, but if it's done in WinXP with only Win32 API i guess it should be possible with standard Linux libs


True, altough if it's done using traditional bit-banging, I have some doubts how reliably it works. Perhaps very well, but not 100%. Then again, there might be some clever way of achieving this (ie. not having to use ioctl).

Solved everything, thanks.

[Edited by - miodragsm on September 30, 2005 1:47:50 PM]

This topic is closed to new replies.

Advertisement