4.3. IO Features
4.3.1. Pulse counting and counting clear
The device supports 3 kinds of pulse counting methods, rising edge counting, falling edge counting,
and level counting. This value can be set by writing the corresponding value to the (0x0053) register.
Writing 0 represents rising edge counting, writing 1 represents falling edge counting, writing 2
represents level counting. If users choose rising edge counting, it will only count when DI detects that
level is on the rising edge. Other functions are similar.
In addition, the device also supports the input count filtering function, and the signal must be held for
several cycles can be confirmed. The default value is 15,15 sampling cycles can be confirmed. The
range is 1-20. This value can be set by writing the corresponding value to the (0x0054) register and the
sampling cycle is 1ms. Note that this function only supports the level counting mode. The pulse count
will not be not saved after power off.
Counting clear also supports manual clear and automatic clear functions: input count is automatically
cleared or manually cleared after reading, which can be set. If it is automatically cleared, the register
value will be cleared after each reading. If it is manually cleared, then either the maximum count of
65536 is cleared or the register is written to clear. Writing 0 to the (0x0055) register means manual
clearing, and writing 1 means automatic clearing. Note that when automatic clearing is set, manual
clearing has no effect.
4.3.1.1. Reading pulse counting value
Function code: 03
,
Read holding register
Address range: 40049 (0x0030)~40056 (0x0037)
Description: Maximum pulse count is 65535
Example:
DI1 has detected 16 pulses currently, DI2 has detected 3 pulses currently. Read the digital input
count value of DI1 and DI2.
Modbus RTU protocol read pulse count value
:
Transmis
sion
01
03
00 30
00 02
C4 04
Device ModBus
Address
Function
code
Initial address
Read numbers
CRC parity code
Receivi
ng
01
03
04
00 10
00 03
BB F7
Device ModBus
Address
Function
code
Return
bytes
numbers
DI1 count
value
DI2 count
value
CRC parity
code