Fuling VFD over MODBUS

Post Reply
mrozner
Posts: 1
Joined: Tue Jun 12, 2018 10:23 pm

Fuling VFD over MODBUS

Post by mrozner » Tue Jun 12, 2018 10:28 pm

I decided to upgrade to a VFD that your software supports with MODBUS and bought a Fuling DZB312. I can get the VFD to speak with your software and see both the blue and red characters in the debug window at the bottom of the Technology/Spindle screen. However, if I try to send commands to WR/Operate and WR/Frequency nothing seems to happen on the VFD, which I have set up for external communications. Should these be in hex or decimal format?

I also noticed that the M03 and M05 commands in the PLC configurations have code associated with controlling the spindle via the DAC. I have not been able to find code to insert for controlling it over MODBUS. If you can send it or point me to the right page that would be appreciated. I have been following this page https://www.pv-automation.com/wiki/pdf- ... ver-modbus. I also cannot see the PLC commands highlighted in red in your screen shot below. They are not there.

I saw another reference that you can only use the Technology/Spindle screen "OR" the PLC to control the spindle. I assume you can switch between them by checking or unchecking the box on the Technology/Spindle screen. Is this true, and are there any things I should watch out for?

I am using your profile 1280M5 as I am building a 5-axis router/mill if that makes a difference. So far everything else works great!

mycnc
Posts: 176
Joined: Thu May 10, 2018 2:42 pm

Re: Fuling VFD over MODBUS

Post by mycnc » Thu Jun 14, 2018 12:04 am

1) "Blue" are messages to VFD
"Red" are messages from VFD. Red messages should be after each blue line which means VFD responds on every income message.
You should also see "Messages:" display Alive. It shows the myCNC software receives messages from VFD and able to decode it correctly.

If "Messages:" is not rotating - something wrong with communication between myCNC and VFD.


2) I just checked configuration which worked with Fuling.
The Fuling Control register is #4096, writing "1" there should start rotation,
writing "0" should stop rotating.

If you get VFD rotating from "Spindle" configuration tab, you may fix PLC procedures M3/M5 to control the VFD via Modbus

3) Example of M03 PLC procedure to start VFD is

Code: Select all

//Turn on Spindle clockwise
#include vars.h
main()
{
  timer=0;
  proc=plc_proc_spindle;

	//command to myCNC controller to send Speed value to VFD 
	//(WR/Frequency register should be configured for VFD in "Spindle" configuration tab)
  message=PLCCMD_MODBUS_SPINDLE_SPEED;
  command=eparam;
  parameter=eparam;
  timer=10; do{timer--;} while (timer>0);

	//command to myCNC controller to send Speed value to VFD 
	//(WR/Frequency register should be configured for VFD in "Spindle" configuration tab)
  message=PLCCMD_MODBUS_SPINDLE_CMD;
  command=1;
  parameter=1;
  timer=10; do{timer--;} while (timer>0);


	//Inform myCNC Software about actual VFD speed
  command=PLC_MESSAGE_SPINDLE_SPEED_CHANGED;
  parameter=eparam;
  message=PLCCMD_REPLY_TO_MYCNC;
  timer=10; do{timer--;} while (timer>0);  //pause to push the message with Spindle Speed data

	//delay after spindle started
  timeout=timer+spindle_on_delay;
  do{timer++;}while (timer<timeout); //delay for Spindle reach given speed

  exit(99);	//normal exit 
};

and to stop VFD we need to send "0" with PLCCMD_MODBUS_SPINDLE_CMD message like this

Code: Select all

//Turn OFF Spindle clockwise
#include vars.h
main()
{
  timer=0;
  proc=plc_proc_idle;

	//command to myCNC controller to send Speed value to VFD 
	//(WR/Frequency register should be configured for VFD in "Spindle" configuration tab)
  message=PLCCMD_MODBUS_SPINDLE_CMD;
  command=0;
  parameter=0;
  timer=10; do{timer--;} while (timer>0);

  exit(99);	//normal exit 
};

mycnc
Posts: 176
Joined: Thu May 10, 2018 2:42 pm

Re: Fuling VFD over MODBUS

Post by mycnc » Thu Jun 14, 2018 12:25 am

API through PLC Messages described above has pros and cons.

Cons:
Quite complicated programming from PLC
Pros:
Easy diagnostic.
Once Modbus configured properly in "Spindle" configuration tab, myCNC controller polls automatically Modbus registers (checked in "Read registers" section) and may show VFD current status like speed rotation, errors, temperature etc.
"Messages:" indicator shows communication.
Incoming and outcoming messages available in "Modbus diagnostics" widget.
For this API myCNC controller sends messages to VFD and wait for a correct reply from VFD. In case no reply received it will repeat automatically sending the message up to 4 times.


We have also "Low-Level" API to access to Modbus devices.
You can read about it in our Wiki

Post Reply