![Acromag 901MB Скачать руководство пользователя страница 10](http://html1.mh-extra.com/html/acromag/901mb/901mb_user-manual_2841142010.webp)
BusWorks
Model 903MB/902MB/901MB Network I/O Module User’s Manual Digital I/O
___________________________________________________________________________________________
- 10 -
The master’s application program must handle the exception
response. It may choose to post subsequent retries of the
original message, it may try sending diagnostic messages to the
slave, or it may simply notify the operator an exception error has
occurred.
The following paragraphs describe the Modbus functions
supported by Model 901MB/902MB/903MB modules. Note that
not all commands apply to each model. To gain a better
understanding of Modbus, please refer to the register map as you
review this material.
Read Coil Status (01)
(902MB & 903MB Models Only)
This command will read the ON/OFF status of discrete
outputs or coils (0x reference addresses) in the slave. For
902MB/903MB models, its response is equivalent to the gate
signal of the n-channel mosfet that drives the output. On 903MB
models which include tandem input channels, you can read the
corresponding input via the Read Input Status command to
determine the actual state of the drain via closed-loop feedback.
Broadcast transmission is not supported.
The Read Coil Status query specifies the starting coil (output
channel) and quantity of coils to be read. Coils correspond to the
discrete open-drain outputs and are addressed starting from 0
(up to 12 coils addressed as 0-11 for these models).
The Read Coil Status in the response message is packed as
one coil or channel per bit of the data field. The output status is
indicated as 1 for ON (sinking current), and 0 for OFF (not
conducting). The LSB of the first data byte corresponds to the
status of the coil addressed in the query. The other coils follow
sequentially, moving toward the high order end of the byte, and
from low order to high order in any subsequent byte. If the
returned coil quantity is not eight, the remaining bits of the data
byte will be set to zero toward the unused high order end of the
byte. The following example reads the output channel status of
coils 0-11 at slave device 247:
Read Coil Status Example Query
Field Name
Example Value (Hex)
Slave Address
247 (F7)
Function Code
1 (01)
Starting Address High Order
0 (00)
Starting Address Low Order
0 (00)
Number Of Points High Order
0 (00)
Number Of Points Low Order
12 (0C)
Error Check (LRC or CRC)
--
Note that the leading character of the 0x reference address is
implied by the function code and omitted from the address
specified. In this example, the first address is 00001 and
referenced via 0000H and this corresponds to coil 0.
Read Coil Status Example Response
Field Name
Example Value (Hex)
Slave Address
247 (F7)
Function Code
1 (01)
Byte Count
2 (02)
Data (Coils 7-0)
170 (AA)
Data (Coils 11-08)
10 (0A)
Error Check (LRC or CRC)
--
To summarize, the status of coils 7-0 is shown as the byte
value AA hex, or 10101010 binary. Coil 7 is the MSB of this byte,
and coil 0 is the LSB of this byte. Reading left to right, the output
status of coils 7..0 is ON-OFF-ON-OFF-ON-OFF-ON-OFF. This
is summarized as follows:
Bin
1
0
1
0
1
0
1
0
Hex
A
A
Coil
7
6
5
4
3
2
1
0
In the last (second) data byte, the status of coils 11..8 is
shown as the byte value 0A hex, or binary 0000 1010. Coil 11 is
the fifth bit position from the left and coil 08 is the LSB of this
byte. The four remaining bits (toward high-order end) are zero.
Bin
0
0
0
0
1
0
1
0
Hex
0
A
Coil
NA
NA
NA
NA
11
10
9
8
Read Input Status (02)
(901MB & 903MB Models Only)
This command will read the binary ON/OFF status of discrete
inputs (1x reference addresses) at the slave. On 903MB models
which have tandem input/output channels, you can read the
corresponding state of the output drain via closed-loop feedback
with this command. Broadcast transmission is not supported.
The Read Input Status query specifies the starting discrete
input channel and quantity of inputs to be read. Inputs are
addressed starting from 0 (up to 12 inputs addressed as 0-11).
Note that for 903MB models, and unlike the Read Coil Status
command, this command reflects the actual state of the output
drain, rather than the gate control signal that turns the output ON.
The Read Input Status in the response message is packed
as one input channel per bit of the data field. Inputs of these
models are asserted low. That is, the input status is indicated as
1 for ON (output sinking current or a low input signal), and 0 for
OFF (output not conducting or a high input signal). The LSB of
the first data byte corresponds to the status of the input
addressed in the query. The other coils follow sequentially,
moving toward the high order end of the byte, and from low order
to high order in any subsequent byte. If the returned coil quantity
is not eight, the remaining bits of the data byte will be set to zero
toward the unused high order end of the byte. The following
example reads the input channel status of digital inputs 0-11 at
slave device 247:
Read Input Status Example Query
Field Name
Example Value (Hex)
Slave Address
247 (F7)
Function Code
2 (02)
Starting Address High Order
0 (00)
Starting Address Low Order
0 (00)
Number Of Points High Order
0 (00)
Number Of Points Low Order
12 (0C)
Error Check (LRC or CRC)
--
Note that the leading character of the 1x reference address is
implied by the function code and omitted from the address
specified. In this example, the first address is 10001 and
referenced via 0000H and this corresponds to input channel 0.