I am using a linux machine with an USB port and I have to communicate with a temperature controller which has an UART port and for this I am using a USB to UART Serial Adapter.
port name on my machine is /dev/ttyUSB0
-
$port = "/dev/ttyUSB0";
-
open(SERIALPORT,"+>$port") || die("ERROR SENDING DATA\n");
-
SERIALPORT->autoflush();
-
-
## in between I am sending data
-
-
print $FILEHANDLE $data;
-
and receiving back from that temperature controller ##
after all that process I am closing that file handle.
code is working fine one time . I am getting correct result .
but when I am trying to run the script second time then it hands at the step when I am sending data to temperature controller
and for this I have to unplug and plug that USB serial adapter again.after that it is working fine.
I am unable to find out what is the problem.
Can u people figure out what may be the possible reasons for it.
Thanks for your reply in advance.