Tingers All American 747 Posts user info edit post |
I can read and write individually to a COM Port, however I can not seem to read and write with the same port without closing, then opening a new port session as seen bellow. Any ideas?
Just as a bit more information, this is also being done on windows unfortunetly
$comPort = "COM4";
#read from COM port open( PORT, $comPort) or die "Can't open" . $comPort; $portLine = <PORT>; close( PORT);
#do stuff with $portLine
#write to COM port open( PORT, ">>" . $comPort) || die "Can't open" . $comPort; print PORT $portLine: close(PORT);
[Edited on October 11, 2010 at 7:07 PM. Reason : adding information] 10/11/2010 7:04:17 PM |
Potty Mouth Suspended 571 Posts user info edit post |
It isn't elegant but is there something preventing you from just closing and opening to use them? 10/11/2010 8:48:24 PM |
scud All American 10804 Posts user info edit post |
You probably want two different file handles, a read and a write. Have you tried that ?
Also what's up with inconsistent styling ? 10/11/2010 10:10:25 PM |
evan All American 27701 Posts user info edit post |
http://search.cpan.org/dist/Win32-SerialPort/lib/Win32/SerialPort.pm 10/11/2010 11:09:04 PM |
Tingers All American 747 Posts user info edit post |
Potty Mouth: I am trying to send data into an FPGA, and capture the resulting output. Part of the data would be gone before I could get the new COM Port open.
scud: This is not my actual code, just tried to show something quick so it was easier to get my point across.
evan: Thanks, I was just hoping there would have been a way without having to install Win32 serial port software. That way anyone wanting to verify my FPGA results would not have to download and install several different kinds of supporting software.
[Edited on October 12, 2010 at 2:39 AM. Reason : ,] 10/12/2010 2:37:48 AM |