in reply to Re^2: Using Device::SerialPort
in thread Using Device::SerialPort

Forgot to mention that I am using cygwin on Windows Computer. The device is a real hardware whose serial port is where I am trying to send some data & read the response back. So what I do is send commands from Hyper-terminal to the hardware using the serial port. For the command that I send, I get some response back. This is the why I am aware of what response I am looking for. Now I go back into cygwin perl environment & using Device::SerialPort module I attempt to send the same command. When i try reading the response, I see those scribbled characters. I have my framework developed in perl & communicating to serial port is just a small part of it. Hence the reason I am trying to incorporate perl's Device::SerialPort into my perl framework. Are you aware of any other method to open up Serial Port in perl & send commands ? Please let me know, if you have any more questions & thanks for your help.

Replies are listed 'Best First'.
Re^4: Using Device::SerialPort
by dasgar (Priest) on Feb 11, 2015 at 05:57 UTC

    Since you are running on Windows, it's possible that Cygwin's Perl could be able use Win32::SerialPort. The syntax of Win32::SerialPort and Device::SerialPort will be very similar.

Re^4: Using Device::SerialPort
by Anonymous Monk on Feb 11, 2015 at 14:00 UTC

    It's been a long time since I last used Cygwin, but since it's "just" a compatibility/emulation layer, I wouldn't be surprised at all if there were issues with its handling of serial ports and/or the interaction of Windows, Cygwin and Device::SerialPort. Have you tried accessing the serial port from inside the Cygwin environment, for example via screen? Also, and this is a complete stab in the dark, perhaps the baud rate setting is getting messed up somehow, and you could try setting the default baud rate of the port in the Windows Control Panel in the Device Manager.

    If you're not entirely fixed on Cygwin, as a possible alternative, Win32::SerialPort should work under Strawberry Perl (I have seen at least one report that someone had to use the 32-bit edition of Strawberry Perl even on a 64-bit Windows, though).

    You asked about other alternatives: Yes, there are some more "low-level" ways of opening and communicating with the serial port in Perl, but in my experience those can sometimes become so tricky to get right that it's probably better to first try to get Win32::SerialPort or Device::SerialPort working.