PaulNg has asked for the wisdom of the Perl Monks concerning the following question:
Latest update: Hi all, It's not the negative values that is throwing it off, rather the ff (Ascii chr 255) that the Telnet.pm can't seem to send! Can anyone advise me how can I do this? Thanks
Hi all,
I'm having problems with Telnet.pm and negative values. For some unknown reason, the reply in the buffer seems to be dropping characters, even a send doesn't seem to be sending correctly as the value on the controller did not respond. However, using a simulator, the value seems to have been sent correctly. Does anyone know why? All help is greatly appreciated. The controller I'm connected to is a WATLOW F4.
---MODBUS Packet details--- Slave address: 1 Read Write: 6 Start Address 1: 01 Start Address 2: 2c Value 1: ff Value 2: 9b CRC 1: 73 CRC 2: 164 ASCII characters sent: !,ÿI¤! Buff data: !,I¤!
$data = join('',@buffor); #M +odbus frame to scalar # chomp($data); print "ASCII characters sent: !$data!\n"; if ($Telnet) { $pass=$ob->print($data) or warn "Modbus client : problem with send: $! +\n"; } else { $pass=$ob->write($data) or warn "Modbus client : problem with send: $! +\n"; } if ($Telnet) { # Telnet $TimeOut = int($TimeOut / 1000); # Con +vert to seconds $ob->errmode('return'); my $i = 0; do { $Buffer = $ob->get(TimeOut => 1); print "Buff data: !$Buffer!\n"; if (defined($Buffer)) { $i = 0; $Reply .= $Buffer; } else { $i++; } } until ((! defined($Buffer) and $i >= $TimeOu +t) or length($Reply) >= 8);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Telnet.pm and Negative Values for Modbus
by thundergnat (Deacon) on Feb 23, 2012 at 19:20 UTC | |
by PaulNg (Novice) on Feb 24, 2012 at 02:00 UTC | |
|
Re: Telnet.pm and Negative Values for Modbus
by thundergnat (Deacon) on Feb 24, 2012 at 15:52 UTC |