Re: Com and Serial Ports
by BrowserUk (Patriarch) on Sep 24, 2003 at 11:25 UTC
|
You'll probably need to be a little more clear in what your trying to achieve before you'll get a good answer.
- Do you want to have a conversation between your program and the device(s) on the other end or just 'monitor the traffic passing through?
- What OS(s) are you targeting?
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.
| [reply] |
|
|
Hmm.. i see..
The program is to receive data. This data is transmited by satellite and received by a device that is connected to a com or serial port.
What I want to do is a program that listen the port and when it receives the data do some king of process.
My question is if there is any module that can listen a port. The OS can be either windows or linux.
Thank you for your valuable help.
Nuno
| [reply] |
|
|
| [reply] |
Re: Com and Serial Ports
by ronzomckelvey (Acolyte) on Sep 24, 2003 at 13:35 UTC
|
Hi..
I posted how I deal with serial ports on this other node, by using STDIN and STDOUT, with Linux doing the redirects:
need to capture serial port output
janitored by ybiC: make link PerlMonks login-friendly ala [id://293583] instead of <a href="http://www.perlmonks.org/index.pl?node_id=293583">need to capture serial port output</a> | [reply] [d/l] [select] |
|
|
thanks.. I'll remember that..
| [reply] |
|
|
Thank you for your help.
I´ve seen a little bit of the modules and the post that you suggested, but i´m wondering if with this module i can make a script that is always "watching" the port! And when the port receives something the script processes something.. but being always watching the port because we´ll never know when we are going to receive data!
Thank you once again
Nuno
| [reply] |
Re: Com and Serial Ports
by diskcrash (Hermit) on Sep 24, 2003 at 23:33 UTC
|
| [reply] |
|
|
Thank you very much for your tip!
In fact that solved my problem, thank you.
I have one more question. I´m using this code in a machine with Linux, and the code catches the data that comes from the serial port. The problem is that i cannot capture special caracters such as: é or olá, any caracter that as an accent!
For example: it appears "informa‡”es" instead of "informações"
Is there any way of resolving this?
Thank you very much for your help.
Nuno
| [reply] |
|
|
If you want to be able to read utf data from your serial port, then you probably need to be using at least perl 5.8, and using the new "IO layer", ':utf8' on the open to set the filehandle to expect utf-8 data.
If your using Device::Serial, you probably aren't doing the open yourself, in which case you need to get hold of the filehandle being used (which appears to be available via $PortObj->{FD}) and use binmode to set the IOlayer to utf8
use Device::SerialPort;
my $PortObj = Device::SerialPort( ... );
binmode $PortObj->{FD}, ':utf8';
...
Note: This is an educated guess. It's based upon my use of Win32::SerialPort (of which Device::SerialPort is an emulation), but I've no way to verify the speculation.
HTH.
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.
| [reply] [d/l] [select] |
|
|
|
|
|