DUEMMEGI
MCP 4 – User's manual
Contatto
11.3.4- Function 4: Reading analog inputs
The MODBUS function 4 is substantially equivalent to the function 3, therefore refer to this last one.
11.3.5- Function 5: Command of a single output digital point
The function 5 allows to force the status of a single output digital point, both real and virtual one; it is
necessary to specify:
REAL OUTPUT:
the number of the real output point to be forced (Number)
; said
i
the address of the
real module of
Contatto
system, a point of which has to be changed and said
p
the output point to be
changed, then Number must be set to
[(i –1) x 64 + p – 1] + (CH – 1) x 16
. Allowed values for
i
range
from 1 to 127, for
p
they range from 1 to 16 and for
CH
they range from 1 to 4.
VIRTUAL OUPUT:
the number of the output virtual point to be forced (Number)
; said
n
the number
of the virtual point to be changed, then Number must be set to
16384 + n - 1
. Allowed values for
n
range
from 1 to 2032.
new status of the output point
(0xFF00=ON, 0x0000=OFF).
Example:
Switch on the point 3 (channel 1) of the output module addressed 29. The parameters to be passed to the
MODBUS driver are:
Number:
1794
Status:
0xFF00
11.3.6- Function 6: Writing a single register (RAM memory)
The function 6 allows to write a value into a single Word of the RAM memory of MCP 4, that contains all
information about the status of the system. The function 16 is more used than the function 6.
The following parameters have to be specified:
Number
: this value
is the Word address
where the new value has to be written. Allowed values for
Number:
from 0 to 30143
(in hexadecimal from 0x0000 to 0x75BF).
Data: the value to be written
into the specified Word.
11.3.7- Function 16: Writing multiple registers (RAM memory)
The function 16 allows to write into the external RAM memory of MCP 4, that contains all information about
the status of the system. This function, together to function 3,
is the most used
.
The following parameters have to be specified:
a starting point (Start)
; this value
is the address of the RAM Word
starting from which the new values
have to be written. Allowed values for Start:
from 0 to 30143
(in hexadecimal from 0x0000 to 0x75BF).
The
internal memory
of the microcontroller MUST NOT BE MODIFIED.
how many registers have to be written (Number)
; in practice, how many consecutive Words have to
be written. Allowed values: from
1 to 125
.
the values to be written (Data)
in the specified Words; each data (the amount is specified by Number)
must be made by 2 bytes (1 WORD).
The MODBUS drivers normally provide the possibility to write one or more whole Words (useful for instance
to change the content of a counter or to change an analog output), or to change a single bit of the Word (for
instance to control a single real output or to change the status of a virtual point).
DUEMMEGI
s.r.l. - Via Longhena, 4 – 20139 MILANO
Tel. 02/57300377 - Fax 02/55213686 –
www.duemmegi.it
Rel.: 1.2 October 2018
Page 75 of 87