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);

In reply to Telnet.pm and Negative Values for Modbus by PaulNg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.