Device-Modbus

 view release on metacpan or  search on metacpan

lib/Device/Modbus/Request.pm  view on Meta::CPAN

For functions 0x01 and 0x02, quantity must be less than or equal to 2000. For functions 0x03 and 0x04, the maximum is 125.

=back

=head4 * Write Single Coil and Write Single Register

These functions have codes 5 and 6.

=over

=item address

Coded in a 16-bit word, so the address must be between 0 and 65535.

=item value

For a single coil, the value is taken as true or false. False values include undef, the empty string, and 0. Register values are always a number between 0 and 65535.

=back

=head4 * Write Multiple Coils

This is function code 15, 0x0F.

=over

=item address

Coded in a 16-bit word, so the address must be between 0 and 65535.

=item values

You can enter up to 1968 values in an array reference. Each value will be treated as a true or false value.

=back

=head4 * Write Multiple Registers

This is function code 16, 0x10.

=over

=item address

Coded in a 16-bit word, so the address must be between 0 and 65535.

=item values

You can enter up to 123 values in an array reference. Each value will be coded in a 16-bit word, so they must be between 0 and 65535.

=back

=head4 * Read/Write Multiple Registers

This is function number 0x17. It requires the following arguments:

=over

=item read_address

The address where you want to start reading registers. As usual, it must be a number between 0 and 65535.

=item read_quantity

A number up to 125. This is the number of registers that will be read.

=item write_address

The address where you want to start writing register values. Again, it must be a number between 0 and 65535.

=item values

You can enter up to 121 values in an array reference. Each value will be coded in a 16-bit word, so they must be between 0 and 65535.

=back

=head2 pdu

This method returns the binary representation of the request. Before sending it to a server (or to a slave, which amounts to the same), you must wrap the PDU within a protocol header and footer. See the ADU methods of the clients for this.

=head1 AUTHOR

Julio Fraire, E<lt>julio.fraire@gmail.comE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2015 by Julio Fraire
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.14.2 or,
at your option, any later version of Perl 5 you may have available.

=cut

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.536 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )