-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodbus.tbh
48 lines (38 loc) · 1.51 KB
/
modbus.tbh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
type modbus_socket
socket as byte
end type
' Read Input Registers
#define MODBUS_ADC_INPUT_REGISTER_HEX 0
#define MODBUS_ADC_INPUT_REGISTER_FLOAT 100
#define MODBUS_COUNTER_INPUT_REGISTER 200
#define MODBUS_BP_LIST_PORT1_INPUT_REGISTER 300
#define MODBUS_BP_LIST_PORT2_INPUT_REGISTER 450
#define MODBUS_BP_LIST_PORT3_INPUT_REGISTER 600
#define MODBUS_BP_LIST_PORT4_INPUT_REGISTER 750
#define MODBUS_OW_LIST_PORT1_INPUT_REGISTER 1000
#define MODBUS_OW_LIST_PORT2_INPUT_REGISTER 1100
#define MODBUS_OW_LIST_PORT3_INPUT_REGISTER 1200
#define MODBUS_OW_LIST_PORT4_INPUT_REGISTER 1300
#define MODBUS_OW_LIST_PORT5_INPUT_REGISTER 1400
#define MODBUS_OW_LIST_PORT6_INPUT_REGISTER 1500
#define MODBUS_OW_LIST_PORT7_INPUT_REGISTER 1600
#define MODBUS_OW_LIST_PORT8_INPUT_REGISTER 1700
#define MODBUS_DAC_HOLDING_REGISTER 0
#define MODBUS_PWM_PULSE_HOLDING_REGISTER 100
#define MODBUS_PWM_PERIOD_HOLDING_REGISTER 200
enum modbusFunc
ReadCoilStatus = 1,
ReadInputStatus = 2,
ReadHoldingRegisters = 3,
ReadInputRegisters = 4,
ForceSingleCoil = 5,
PresetSingleRegister = 6,
ForceMultipleCoils = 15,
PresetMultipleRegisters = 16
end enum
declare modbus_socks(MODBUS_SOCKS_MAX) as modbus_socket
declare function modbus_initialize() as boolean
declare sub modbus_tcp_receive(byref data as string, socketTCP as byte)
declare function modbus_set_holding_register(register as word, value as word) as boolean
declare function modbus_get_holding_register(register as word) as word
declare function modbus_get_input_register(register as word) as word