This is a simplified version of Modbus TCP that allows PICS to simulate the equipment:
- All you need to do to get this running is going into the spiffs folder and open Objects.csv
- You wil create your Modbus Register Map, this will based on the equipment or UDTs
- For Input Coil & Input Registers, you will need to create a Output Coil & Holding Register to edit the value
- Once you modify the Objects.csv file, build and flash the program into the ESP32 board
- Go to TOP Server and add the Modbus TCP/IP device
For PICS:
- Create an I/O Connection, Set it as OPC Client, choose TOPServer
- To add the Modbus Device (ESP32), create an I/O Variable, Name the I/O
- Under Address, you will follow how Ignition UDT works.
- Device Channel . Device . Tag Name (Address)
- EX: DFW2_DC3_COD_A11_CH.DFW2_DC3_COD_A11.30001
- You will be able to view the data or edit the value
Objects.csv Template / Example:
type: Can be an Input Coil (Input), Output Coil (Output), Input Holding Register (Input_Holding), or Output Holding Register (Holding_Reg)
address: Modbus Register, Inputs: 1 - 9999, Outputs: 10000 - 19999, Input_Holding: 30000 - 39999, Holding_Reg: 40000 - 49999 (They can be 6 digits long as well)
name: Name of Modbus Register
data_type: bool, uint16, float, uint32, double
control_address: Address of Ouput or Holding_Reg that will control this Input; if it's an output leave it blank
notes: Any text that will help you identify it
type,address,name,data_type,control_address,notes
Coil,1,DI1,bool,10005,Digital Input 1
Discrete_Input,10005,DO1,bool,,Digital Output 2
Input_Register,320315,AI1,uint16,465921,Analog Input 1
Holding_Register,465921,AO1,uint16,,Analog Output 1
Description
This is a C style code that allows you to simulate Modbus TCP devices on ESP32 boards.
This is a simplified version where you use a CSV file to generate the device you want to simulate and use PICS to simulate the values and behavior of the device instead of pre-programming it.
Languages
C
99.7%
CMake
0.3%