perl - Win32::Serial Binary Communication -
i trying communicate uart on embedded system using win32::serial port (perl module). seems work fine in terms of sending data, ever reason unable receive data. hoping there function besides read() show read data?
# write serial data port in little endian form foreach $intermvalue (@writedata) { $msb = int($intermvalue/256); $lsb = ($intermvalue - $msb*256); # writing lsb first , msb after (little endian form) print "writing: lsb: ".$lsb." msb: ".$msb."\n"; $class->{"serialport"}->transmit_char($lsb); $class->{"serialport"}->transmit_char($msb); } # read data serial port ($countin, $recieveddata) = $class->{"serialport"}->read($expectedbytes);
thanks
thanks reply, turns out there input function in library, using , 1 second sleep able make module work.
# write serial data port in little endian form foreach $intermvalue (@writedata) { $msb = int($intermvalue/256); $lsb = ($intermvalue - $msb*256); # writing lsb first , msb after (little endian form) print "writing: lsb: ".$lsb." msb: ".$msb."\n"; $class->{"serialport"}->transmit_char($lsb); $class->{"serialport"}->transmit_char($msb); } # read data serial port sleep(1); $recieveddata = $class->{"serialport"}->input;
Comments
Post a Comment