User Tools

Site Tools


plc:plc_modbus_api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
plc:plc_modbus_api [2019/07/29 13:11]
ivan
plc:plc_modbus_api [2020/07/03 11:27] (current)
ivan
Line 1: Line 1:
 ===== PLC/Modbus API ===== ===== PLC/Modbus API =====
  
 +{{youtube>​xb8TfhysbF8?​large}}
  
 A number of Variables from [[mycnc:​global_variables|Global Variable Array]] are mapped to Modbus interface. It's possible to setup Modbus device ID, communication parameters and speed, and access to device Modbus Registers by writing to this variables. A number of Variables from [[mycnc:​global_variables|Global Variable Array]] are mapped to Modbus interface. It's possible to setup Modbus device ID, communication parameters and speed, and access to device Modbus Registers by writing to this variables.
Line 20: Line 21:
 | 60030 | **Write Register**. ​ Writing to register will send value from shadow register to Modbus devive ​ to address given in written value on **write** operation | 16 | | 60030 | **Write Register**. ​ Writing to register will send value from shadow register to Modbus devive ​ to address given in written value on **write** operation | 16 |
 | 60031 | **Read Register**. Read from this register will send read inquiry to Modbus device (PLC controller will be in Sleep till Register value received from Modbus device). Writing to this register will send ready inquiry to Modbus device. The value written is used as Register address to read  | 3 | | 60031 | **Read Register**. Read from this register will send read inquiry to Modbus device (PLC controller will be in Sleep till Register value received from Modbus device). Writing to this register will send ready inquiry to Modbus device. The value written is used as Register address to read  | 3 |
-| 60035 | **Write multiple coils**. ​Write multiple coils command ​indicates the 16-bit ​address of first coil to write, ​the number of coils to write, number of bytes of coil values to follow, and the coil values The response ​will be the address of the first coil and the number of coils. | 15 |+| 60035 | **Write multiple coils**. ​Low 16 bits of the value indicates the address of the first coil should be written. The high byte of the value (value>>​24) indicates ​number of coils to write. The value latched in 60019 register ​will be sent to the device. | 15 |
 | 60037 | **Write single register**. Write single register indicates address of the holding register and the new value of the register. The response, similarly, is the address of the register and the new value. ​ | 6 | | 60037 | **Write single register**. Write single register indicates address of the holding register and the new value of the register. The response, similarly, is the address of the register and the new value. ​ | 6 |
 | 60038 | **Write single coil**. Requests the 16-bit address of the coil, and the value to write (0 for OFF, FF00 for ON) | 5| | 60038 | **Write single coil**. Requests the 16-bit address of the coil, and the value to write (0 for OFF, FF00 for ON) | 5|
Line 102: Line 103:
 Modbus Scheduler in myCNC has 4 messages queue. Up to 4 registers can be written immediately from PLC procedure. Modbus manager will send it one-by-one and will be waiting a reply from Modbus device after each message. ​ Modbus Scheduler in myCNC has 4 messages queue. Up to 4 registers can be written immediately from PLC procedure. Modbus manager will send it one-by-one and will be waiting a reply from Modbus device after each message. ​
  
-Modbus manager will repeat the message to device up to 4 times in case no reply in 250ms. ​+Modbus manager will repeat the message to device up to 4 times in case no reply is received within ​250ms. ​
  
 <​code>​Important! <​code>​Important!
-If Modbus device is controlled directly from the PLC procedure, "​RS485/​Modbus communication" ​+If the Modbus device is controlled directly from the PLC procedure, "​RS485/​Modbus communication" ​
 checkbox should be UNCHECKED in Settings > Config > Technology > Mill/Lathe > Spindle ​ checkbox should be UNCHECKED in Settings > Config > Technology > Mill/Lathe > Spindle ​
 configuration dialog </​code>​ configuration dialog </​code>​
plc/plc_modbus_api.1564420263.txt.gz ยท Last modified: 2019/07/29 13:11 by ivan