1.32 1.31 1.30 1.29 1.28 1.20 Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish
1.32 1.31 1.30 1.29 1.28 1.20 Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish

CDRFLEx.add_modbus_signal

Features

This is a function for using the Modbus I/O signal by registering it in advance. The modbus I/O signal registered using this function should be reset after rebooting, as it is stored in the memory. However, if it is registered in the T/P application, it can be reused, as it is added in the initialization process.

Parameter

Parameter Name

Data Type

Default Value

Description

strSymbol

string

-

modbus signal Name

strIpAddress

string

-

modbus module ip address

nPort

unsigned short

-

modbus module port

eRegType

enum

-

Refer to the Definition of Constant and Enumeration Type

iRegIndex

unsigned short

-

Index of Modbus signal

nRegValue

unsigned short

0

Output value when type is MODBUS_REGISTER_TYPE_COILS or MODBUS_REGISTER_TYPE_HOLDING_REGISTER (ignored in other cases)

Return

Value

Description

0

Error

1

Success

Example

C++
/*
Example of connecting Modbus IO and allocating contact point 
Modbus IO IP: 192.168.127.254
input 2 points: “di1”,”di2”
*/

// set <modbus> input : “di1”, “di2” 
drfl.add_modbus_signal("di1", "192.168.127.254" , 502, MODBUS_REGISTER_TYPE_DISCRETE_INPUTS, 0, 0);

drfl.add_modbus_signal("di2", "192.168.127.254" , 502, MODBUS_REGISTER_TYPE_DISCRETE_INPUTS, 0, 0);