99 lines
4.4 KiB
Plaintext
99 lines
4.4 KiB
Plaintext
Modbus TCP (CSV Configuartion):
|
|
|
|
1. Start Here!
|
|
a. Go into the "spiffs" folder and open "device_config.ini"
|
|
|
|
b. Under [wifi] you will enter the SSID (Name) of your wifi router
|
|
and password.
|
|
|
|
c. Setup the "static_ip" of the device, "gateway" of the network (router)
|
|
and leave "netmask" as default (255.255.255.0).
|
|
|
|
d. Under [modbus] leave port as default (502), leave max_clients as default (10)
|
|
and modify "device_count" to the max amount of devices you want to simulate
|
|
- Note: This will be based on the size of the modbus mapping you will use, the larger
|
|
the larger the mapping the more memory, the less devices you can simulate.
|
|
|
|
e. Under [device 1], use this as a template to add devices, leave "enabled" as default (1),
|
|
modify "unit_id", do not have duplicate IDs, "name" has to follow Deivce_x, "csv" will match the
|
|
csv file mapping you created or copied over.
|
|
|
|
2. Creating CSV Files for Modbus TCP devices
|
|
|
|
a. In the "spiffs" folder, there is a csv file called "Tempalte.csv"
|
|
- Use this as reference on how to create your devices
|
|
|
|
type,address,name,data_type,control_address,pics_address,pics_data_type,notes
|
|
|
|
|
|
b. For Column "type" this will be the Modbus Register type
|
|
- Coil
|
|
- Discrete_Input
|
|
- Input_Register
|
|
- Holding_Register
|
|
|
|
c. For Column "address", you will enter the modbus register , can be 5 digits or 6 digits
|
|
- Coil: 00001 -> 09999 or 000001 -> 099999
|
|
- Discrete_Input: 10001 -> 19999 or 100001 -> 199999
|
|
- Input_Register: 30001 -> 39999 or 300001 -> 399999
|
|
- Holding_Register: 40001 -> 49999 or 400001 -> 499999
|
|
|
|
d. For Column "name", enter the name of that point, can be whatever you want
|
|
|
|
e. For Column "data_type", this will be the type of data the point represents
|
|
- Coil: bool only
|
|
- Discrete_Input: bool only
|
|
- Input_Register: uint16, uint32, or float
|
|
- Holding_Register: uint16, uint32, or float
|
|
|
|
f. For Column "control_address", this is only for registers that are read only (inputs)
|
|
- Create a counterpart of that input and type in the "address" of that point into "control_address"
|
|
|
|
- For Example: Discrete_Input,10001,DI_1,bool,00001,,,,
|
|
Coil,00001,DI_1_Ovr,bool,,,,,
|
|
|
|
Input_Register,30001,AI_1,uint16,40001,,,,
|
|
Holding_Register,40001,AI_1_Ovr,uint16,,,,
|
|
|
|
g. For Column "pics_address", this will be the address PICS uses to modify the data
|
|
- You cannot use the modbus register (address) as PICS write the data in this fashion
|
|
- Recommended default start is 410001
|
|
- Also you do not need to add this address on Coil data types as it's 1 for 1
|
|
- This is primarly needed for Holding_Register
|
|
|
|
- PICS Data:
|
|
- Boolean = sends data in 1 register
|
|
- Integer = sends data in 2 registers
|
|
- Float = sends data in 4 registers
|
|
|
|
h. For Column "pics_data_type", the type of data pics is sending to that modbus register
|
|
- Look at g. for the PICS Data.
|
|
|
|
i. For Column "notes", enter notes to help you understand the purpose of that modbus register
|
|
|
|
3. Increasing Modbus MAX Points
|
|
|
|
a. Once you complete your device csv file, head to "main" -> "modbus_points.h"
|
|
|
|
b. At the very top of the file, find "#define MODBUS_MAX_POINTS"
|
|
- Modify this value based on the maximum registers needed for your device
|
|
|
|
4. Starting Modbus TCP Device
|
|
|
|
a. Once you complete setting up the device, you are ready to flash the device
|
|
|
|
b. Download ESP32 IDF from Espressif Systems
|
|
Link: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/windows-setup.html
|
|
|
|
Install the EIM, follow the easy installation
|
|
|
|
c. Once in the dashboard, click on open IDF terminal
|
|
|
|
d. Run these commands:
|
|
- cd "Location the program is stored at"
|
|
- idf.py fullclean
|
|
- idf.py build
|
|
- idf.py -p COM# flash monitor (COM# is the COM port number, look in Device Manager -> Ports)
|
|
|
|
5. Verify with Modscan32
|