-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodbus_open_close.h
60 lines (29 loc) · 1.63 KB
/
modbus_open_close.h
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
49
50
51
52
53
54
55
56
57
/*************************************************************************
caSCADA -- PID control system program based on libmodbus 3.0.6
By Tony R. Kuphaldt
Last update 10 May 2019
This software is released under the CC0 1.0 Universal license,
which is equivalent to Public Domain.
*************************************************************************/
#include <modbus.h> // Necessary for all modbus connection and
// data read/write functions, and is included
// within this header file for the sake of
// declaring the Modbus pointer ("*Device")
/****************************************************************************
Define Modbus network parameters
****************************************************************************/
#define IP_ADDRESS "169.254.8.1" // IPv4 address of the Modbus/TCP data acquisition unit
#define TCP_PORT 502 // TCP port number used for Modbus/TCP (502 is standard)
#define MODBUS_SLAVE 1 // Slave device address used for serial Modbus
/****************************************************************************
Declare Modbus network pointers
****************************************************************************/
// Declaring Modbus/TCP device pointer
modbus_t *Device;
/****************************************************************************
Function prototypes
****************************************************************************/
// Prototype for initializing the Modbus network connection
int open_modbus_connection (void);
// Prototype for closing the Modbus network connection
int close_modbus_connection (void);