in reply to Win32::SerialPort on Win10 issue
Hi. I was hoping for a recognizable known fault. I trust that I provide the additional data with a comment (like this) to the Issue trail.
I can establish the correctness on the USB unit (OBD2 LM327) connected to COM5 with RealTerm SW (on Laptop Win 10 system). I did have some screen dumps to demonstrate this. But I am unsure if this is possible with this interface. These RealTerm dumps do demonstrate connection of 38,400 baud and 8N1. Also transmitting the command "ati\n" (\n carriage return) gives a response of "ELM327 v1.5 carriage return". Note I have ensured the echoing is off ("ate0\n"), prior to this. This USB unit's operation copies modem AT commands.
The next part of this involves running the same COM5 port setup with not RealTerm but with Perl. The manipulation of the configuration can be achieved with a program like (and the response just below it) ;
#! perl -w use strict; use Win32::SerialPort; my $ob = Win32::SerialPort->new ('COM5') || die; my $baud = $ob->baudrate; my $parity = $ob->parity; my $data = $ob->databits; my $stop = $ob->stopbits; my $hshake = $ob->handshake; print "B = $baud, D = $data, S = $stop, P = $parity, H = $hshake\n"; my @data_opt = $ob->databits; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } @data_opt = $ob->stopbits; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } @data_opt = $ob->handshake; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } @data_opt = $ob->parity; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } @data_opt = $ob->baudrate; # list context print "\nData Bit Options: "; foreach $a (@data_opt) { print " $a"; } undef $ob; ======================= Response ================== B = 38400, D = 8, S = 1, P = none, H = none Data Bit Options: 7 8 Data Bit Options: 2 1 Data Bit Options: rts none dtr xoff Data Bit Options: odd space even none mark Data Bit Options: 300 115200 57600 19200 1200 4800 9600 38400 2400 60 +0
I seem to have no issues with the manupilation of the configuration of COM5.
However, if I cross to a write then read program, coping the above RealTerm success of outputting "ati\n", I get no success. The code used and the response is;
#! C:\perl\bin\perl.exe use strict; use warnings; use Win32::SerialPort; my $port_name = 'COM5'; my $config_file = 'setup.cfg'; my $port = new Win32::SerialPort($port_name, $config_file) || die "Una +ble to open: $^E\n"; # my $status = pack('HHHHHH', 'ca', '00', '01', '00', '00', 'fe'); $port->write("ati"."\n"); sleep 0; my $debug = 1; while(1) { my $line = $port->lookfor(); if( $line ) { { local $/ = "\r"; chomp $line; } if ($debug) { print "[$line]" ;} # Some data processing takes place } else { sleep(1); # Allocate time for other processes to run print "."; } } ======================= Response ================== .......
As you can see from the above I get to the endless loop without any information presented.
My IDE is Eclipse.
Regards JC......
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Win32::SerialPort on Win10 issue
by soonix (Chancellor) on Jul 03, 2024 at 06:45 UTC | |
Re^2: Win32::SerialPort on Win10 issue
by pryrt (Abbot) on Jul 03, 2024 at 13:21 UTC | |
Re^2: Win32::SerialPort on Win10 issue
by stevieb (Canon) on Jul 03, 2024 at 08:55 UTC | |
Re^2: Win32::SerialPort on Win10 issue
by Marshall (Canon) on Jul 03, 2024 at 16:06 UTC | |
by jmClifford (Beadle) on Jul 05, 2024 at 04:22 UTC | |
by jmClifford (Beadle) on Jul 08, 2024 at 13:55 UTC | |
by Marshall (Canon) on Jul 06, 2024 at 02:00 UTC |