Modbus communication with HuanYang VFD and PlanetCNC TNG – Part 2

If connection test was successful, and you can see parameter values displayed in the output window, then we can continue with next step, which is controlling the spindle.

In settings under File/Settings/User Interface/Commands/Spindle Command -> enable option Uses M-Code:

Type M3/M4 into the MDI window and hit Enter. Inverter should start the spindle at set spindle speed, and LED display should show RPM value(if display is in RPM mode).

Output window should print the following text (debug set to 1):

Type M5 into the MDI window and hit Enter. Inverter should stop the spindle:

Expr_VFD_beta.txt file includes also error checking code, which will generate error log file that will log all error events during the communication between the TNG and inverter.
These inverters tend to respond slowly or faulty to external commands and additional retry is necessary. This log file will record how many of such retries there were during the communication.

Example of Error log file and its content:

Two error events, for which in both cases occurred during the Reverse speed set command:




If inverter will not respond to any spindle gcode command , it indicates that something is not ok.
Type into the MDI window the following text:

=debug = 1

Test the M3, M4 and M5 codes again.

Observe the output window and the printed text.