Modbus spindle control using the Sunfar E500
You need next devises to control the spindle via Modbus:
- RS-485 adapter for connecting a frequency converter to a PC;
- frequency converter (FC) with support for control via Modbus RTU.
Modbus spindle control setting procedure:
- Set FC to the control mode using the Modbus RTU protocol (RS-485) and remember the COM port settings in FC (count of bits per second, data bits, parity and stop bits).
Function code | Value | Description |
---|---|---|
F0.00 | 2 | Frequency reference source - external data transfer |
F0.02 | 0002 | Trigger channel selection - serial data port |
F4.00 | 0114 | Data transfer settings - speed selection: 9600 bps, parity check, Modbus data transfer protocol |
2.Connect FC to the PC via the RS-485 adapter. You may need to install the driver for the RS-485 adapter for Windows.
3. Verify that the adapter in RS-485 was detected by the operating system. Use the Windows Device Manager for this.
Remember the COM port number of the device. It will be required in the next steps.
4. Purchase the "MODBUS protocol support" option or activate a trial period for this option in the menu "Configuration" → "License Manager" → "Common".
5. Enable and configure Modbus in the menu "Configuration" → "Modbus Setup".
Create new Modbus-master. Number of COM port is RS-485 adapter number. The rest of the settings should be exactly the same as in the FC (in the screenshot, an example of a standard configuration of the COM port of Sunfar E500).
You need to add registers to control the FC and read statuses from FC. For example you need to configure registers named SpindleMode, SpindleRPM and SpindleStatus for Sunfar E500.
We recommend using exactly these names, since in the future, registers will be accessed from background operations by their names.
6. Create new background operation (macro) through the macro manager.
The main task of the background macro is to monitor the current state and spindle speed and send the values to the frequency converter via Modbus.
An example of background operation modbus_spindle.bm for ModBus spindle control posted in attachment. This file must be added to background operations list.
7. Enable the background operation. Make sure that the operation has started and is working properly. This will be indicated by the green indicator to the right of the operation name.
The spindle should now turn on and off if everything is configured correctly. The spindle speed accordingly must also change at the FC when it changing in PUMOTIX.