Contatto
MCP 4 – User's manual
DUEMMEGI
11.3.2- Function 2: Reading the digital input status
The MODBUS function 2 allows to read the input status; the following parameters has to be specified:
a start point (Start)
; this value
must be multiple of 16
. This value identifies the number of the digital
input starting from 16 and arranged by channel as follows:
Input
Number of the input
Non usato
0
I1:1.1
16
I2:1.1
32
...
...
I127:1.1
2032
Non usato
2048
I1:2.1
2064
I2:2.1
2080
...
...
I127:2.1
4080
Non usato
4096
I1:3.1
4112
I2:3.1
4128
...
...
I127:3.1
6128
Non usato
6144
I1:4.1
6160
I2:4.1
6176
...
...
I127:4.1
8176
The general formula is: said
Add
the address of the real module of
Contatto
system, starting from which
the status of the inputs has to be read and
CH
the channel, then the value of Start will be:
(Add x 16) + 2048 x (CH – 1)
Allowed values:
from 0 to 8176
.
how many input points have to be read (Number)
; in practice, how many modules having consecutive
address have to be read. To avoid confusion, this value is suggested to be
multiple of 16
and equal to
the number of modules to be read multiplied by 16. Allowed values:
from 16 to 8176
.
MCP 4 will answer with a number of bytes equal to Number divided by 8
.
Example 1:
Read the input status of module 43, for instance a MOD8I/A that, as known, features 8 input points and a
single channel (1). The parameters to be passed to MODBUS driver are:
Start:
688
Number:
16
MCP 4 will answer with 2 bytes containing the status of the input points of module 43, according to the binary
code (1=input ON, 0=input OFF). The less significant bit of the lower byte is related to the input point 1, the
most significant bit is related to the input point 8; the higher byte will be, in this case always 0x00 (zero).
Example 2:
Read the input status of modules 57, 58, 59, and 60, for instance all MOD8I/A modules that, as known,
features 8 input points each one. The parameters to be passed to MODBUS driver are:
Start:
912
Number:
64
MCP 4 will answer with 8 bytes containing the status of the input points of modules from 57 to 60 included.
Page 72 of 87
Rel.: 1.2 October 2018
DUEMMEGI
s.r.l. - Via Longhena, 4 – 20139 MILANO
Tel. 02/57300377 - Fax 02/55213686 –
www.duemmegi.it