User Tools

Site Tools


mycnc:modbus_setup

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
mycnc:modbus_setup [2019/09/12 10:40] ivanmycnc: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/Modbus Communication** field in the **Settings > Config > Technology > Mill/Lathe > Spindle** window. 
 +
 +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/Modbus Communication** field in the **Settings > Config > Technology > Mill/Lathe > Spindle** window to OFF.
 +
 +<code>NOTE: The two modes are exclusive - low-level access will not work if the check mark is ON
 +and vice versa</code>
  
 ====I/O expand cards mapping==== ====I/O expand cards mapping====
Line 7: Line 20:
 The transparent mapping of Modbus inputs/outputs can be done through the **I/O Expand cards mapping** window in Settings > Config > Inputs/Outputs/Sensors. In this part, the focus will be on expanding the number of inputs/outputs in a standard myCNC controller using a WELLPRO Modbus device. This process provides the user with a way to easily add 8 more inputs and 8 more outputs per Modbus device connected, allowing to connect more peripherals to the myCNC controller. The transparent mapping of Modbus inputs/outputs can be done through the **I/O Expand cards mapping** window in Settings > Config > Inputs/Outputs/Sensors. In this part, the focus will be on expanding the number of inputs/outputs in a standard myCNC controller using a WELLPRO Modbus device. This process provides the user with a way to easily add 8 more inputs and 8 more outputs per Modbus device connected, allowing to connect more peripherals to the myCNC controller.
  
-<code>NOTE: In order for the Modbus device to connect properly, the  +<code>NOTE: In order for low-level access Modbus devices to connect properly,  
-"RS485/Modbus communication" checkbox should be UNCHECKED in the  +the "RS485/Modbus communication" checkbox should be UNCHECKED in the  
-Config > Technology > Mill/Lathe > Spindle configuration dialog</code>+Config > Technology > Mill/Lathe > Spindle configuration dialog
 +That checkbox is useful for high-level access only. </code>
  
 {{:mycnc:modbus-io-004.png}} {{:mycnc:modbus-io-004.png}}
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 "virtual" ports in myCNC software which do not typically correspond to any physical ports on the controller itself. These virtual ports can therefore be assigned to the Modbus device for it to send its inputs to. In such a way, for Inputs expansion, the Source port can be set to 0 to correspond to the Modbus configuration, and the Destination port can be set to 2, 3, 4, etc in order to "fill" one of the virtual ports in myCNC software.+Destination port is the port to which the inputs are sent to. There is a number of assigned "virtual" ports in myCNC software which do not correspond to any physical ports on the controller itself. These virtual ports can therefore be assigned to the Modbus device for it to send its inputs to. In such a way, for Inputs expansion, the Source port can be set to 0 to correspond to the Modbus configuration, and the Destination port can be set to 2, 3, 4, etc in order to "fill" one of the virtual ports in myCNC software. Note that since the ET7, for example, has 16 inputs, the Destination port can be set to be 2 and above, while for the ET10 (which has 48 inputs) the virtual Destination ports start from 6 and above
  
 ===Input/Output behaviour switch=== ===Input/Output behaviour switch===
Line 57: Line 71:
 The detailed description of the available Modbus devices is located at the [[mycnc:modbus_devices|Modbus Devices]] page. The detailed description of the available Modbus devices is located at the [[mycnc:modbus_devices|Modbus Devices]] page.
  
 +====Example setups====
 +
 +===General communication example===
 +
 +
 +
 +===Sample M03 procedure for Spindle ON through Modbus===
 +
 +++++ Expand M03 code |
 +
 +<code>#include pins.h
 +#include vars.h
 +
 +#define command   var00
 +#define parameter var01
 +
 +// =======================================================================
 +//SPINDLE_ON_CW_VALUE  should be redefined according to VFD specification
 +#define SPINDLE_ON_CW_VALUE   12345
 +// =======================================================================
 +
 +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--;} while (timer>0);
 +
 +  message=PLCCMD_MODBUS_SPINDLE_SPEED;
 +  command=val;
 +  parameter=val;
 +  timer=30; do { timer--; } while (timer>0);
 +
 +
 +  gvarset(7370,1);   //Spindle State
 +  timer=10; do { timer--; } while (timer>0);
 +  gvarset(7371,val); //Spindle Speed Mirror register
 +  timer=10; do { timer--; } while (timer>0);
 +
 +  //delay after spindle started
 +  timeout=timer+spindle_on_delay;
 +  do{timer++;}while (timer<timeout); //delay for Spindle reach given speed
 +
 +  exit(99); //normal exit 
 +}; </code>
 +
 +++++
 +
 +This M03 procedure can be found by going into ''Settings > Config > PLC > Hardware PLC Templates > Mill (Modbus): Spindle CW Turn-ON''.
 +
 +  * As can be seen in the sample code, the ''timeout'' delay is set to the spindle ON delay. This spindle ON delay is specified in the User Settings: 
 +
 +{{:mycnc:modbus-setup-002-timeout-delay.png}}
 +
 +More information on controlling the spindle through Modbus can be found in the [[mycnc:mycnc_configuration_dialogs#spindle|MyCNC Configuration Dialogs (Spindle)]] manual.
mycnc/modbus_setup.txt · Last modified: 2020/07/03 11:26 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki