mycnc:modbus_setup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
mycnc:modbus_setup [2019/07/29 15:53] – ivan | mycnc:modbus_setup [2020/06/16 14:29] – ivan | ||
---|---|---|---|
Line 2: | Line 2: | ||
This article is designed to introduce the reader to the myCNC Modbus setup, as well as serve as the main reference point for all myCNC Modbus documentation. | This article is designed to introduce the reader to the myCNC Modbus setup, as well as serve as the main reference point for all myCNC Modbus documentation. | ||
+ | |||
+ | //Note that on the ET10 control board, Port #1 (A/B) is used for all Modbus communication by default. Port #0 (A/B) is reserved for special purpose applications. Please contact the myCNC development team for implementing a special purpose application through port #0.// | ||
+ | |||
+ | ====Low-level vs high-level access==== | ||
+ | |||
+ | Modbus communication can either be done through high-level access (especially useful for cases where using spindle control through an inverter such as a Delta VFD, Fuling DZB, etc), or through low-level access which allows the user to program the process via a PLC procedure. | ||
+ | |||
+ | High-level access is preferable for its ease of use. The settings for different inverters can be preloaded by going into Settings > Config > Technology > Mill/Lathe > Spindle, and the myCNC system will automatically attempt to send the message again should the sending fail (up to four times). For high-level access, please set the check mark to ON in the **RS485/ | ||
+ | |||
+ | Low-level access is preferable for direct access to the hardware. This allows to program the communication through PLC, and is a very flexible (albeit less straightforward) method. For low-level access the check mark in the **RS485/ | ||
+ | |||
+ | < | ||
+ | and vice versa</ | ||
====I/O expand cards mapping==== | ====I/O expand cards mapping==== | ||
Line 7: | Line 20: | ||
The transparent mapping of Modbus inputs/ | The transparent mapping of Modbus inputs/ | ||
- | < | + | < |
- | " | + | the " |
- | Config > Technology > Mill/Lathe > Spindle configuration dialog</ | + | Config > Technology > Mill/Lathe > Spindle configuration dialog. |
+ | That checkbox is useful for high-level access only. </ | ||
{{: | {{: | ||
Line 32: | Line 46: | ||
===Destination port=== | ===Destination port=== | ||
- | Destination port is the port to which the inputs are sent to. There is a number of assigned " | + | Destination port is the port to which the inputs are sent to. There is a number of assigned " |
===Input/ | ===Input/ | ||
Line 43: | Line 57: | ||
Using the I/O Expand cards mapping window allows for a guaranteed signal delivery even if the Modbus device was turned off when the initial signal was sent (for example, when changing the Binary Outputs status from OFF to ON in the System Diagnostics window). However, a certain amount of latency (up to 100-200 ms) is introduced, as the system has to regularly loop through and check for the inputs/ | Using the I/O Expand cards mapping window allows for a guaranteed signal delivery even if the Modbus device was turned off when the initial signal was sent (for example, when changing the Binary Outputs status from OFF to ON in the System Diagnostics window). However, a certain amount of latency (up to 100-200 ms) is introduced, as the system has to regularly loop through and check for the inputs/ | ||
- | **NOTE:** The latency | + | **NOTE:** The latency |
====Using Modbus through PLC commands==== | ====Using Modbus through PLC commands==== | ||
Line 57: | Line 71: | ||
The detailed description of the available Modbus devices is located at the [[mycnc: | The detailed description of the available Modbus devices is located at the [[mycnc: | ||
+ | ====Example setups==== | ||
+ | |||
+ | ===General communication example=== | ||
+ | |||
+ | |||
+ | |||
+ | ===Sample M03 procedure for Spindle ON through Modbus=== | ||
+ | |||
+ | ++++ Expand M03 code | | ||
+ | |||
+ | < | ||
+ | #include vars.h | ||
+ | |||
+ | #define command | ||
+ | #define parameter var01 | ||
+ | |||
+ | // ======================================================================= | ||
+ | // | ||
+ | #define SPINDLE_ON_CW_VALUE | ||
+ | // ======================================================================= | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | proc=plc_proc_spindle; | ||
+ | |||
+ | timer=0; | ||
+ | val=eparam; | ||
+ | |||
+ | message=PLCCMD_MODBUS_SPINDLE_CMD; | ||
+ | command=SPINDLE_ON_CW_VALUE; | ||
+ | parameter=SPINDLE_ON_CW_VALUE; | ||
+ | timer=10; do{timer--; | ||
+ | |||
+ | message=PLCCMD_MODBUS_SPINDLE_SPEED; | ||
+ | command=val; | ||
+ | parameter=val; | ||
+ | timer=30; do { timer--; } while (timer> | ||
+ | |||
+ | |||
+ | gvarset(7370, | ||
+ | timer=10; do { timer--; } while (timer> | ||
+ | gvarset(7371, | ||
+ | timer=10; do { timer--; } while (timer> | ||
+ | |||
+ | //delay after spindle started | ||
+ | timeout=timer+spindle_on_delay; | ||
+ | do{timer++; | ||
+ | |||
+ | exit(99); | ||
+ | }; </ | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | This M03 procedure can be found by going into '' | ||
+ | |||
+ | * As can be seen in the sample code, the '' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | More information on controlling the spindle through Modbus can be found in the [[mycnc: |
mycnc/modbus_setup.txt · Last modified: 2020/07/03 11:26 by ivan