Hello Guest it is January 28, 2023, 05:44:36 AM

Author Topic: Mach4 VFD Spindle setup  (Read 3159 times)

0 Members and 1 Guest are viewing this topic.

Mach4 VFD Spindle setup
« on: February 15, 2016, 03:37:01 PM »
I am completely lost, I have no idea what to do here, I have a VFD Spindle, which I think is serial or Modbus, is there a difference between serial and Modbus or are they the same?

I cant figure out how to set this up in Mach 4 have been fumbling around with this for about a week now.

Offline DazTheGas

  •  776 776
  • DazTheGas
    • View Profile
Re: Mach4 VFD Spindle setup
« Reply #1 on: February 15, 2016, 03:53:37 PM »
Perhaps post the make and model of the VFD.

New For 2022 - Instagram: dazthegas
Re: Mach4 VFD Spindle setup
« Reply #2 on: February 16, 2016, 09:35:45 AM »
Perhaps post the make and model of the VFD.


The VFD is Teco 7300CV from FactoryMation.com with the RS-232 interface card

I have found info on making a brain for mach3 and some other stuff geared towards mach3, but it doesn't seem to make sense on mach4
Re: Mach4 VFD Spindle setup
« Reply #3 on: February 16, 2016, 01:22:33 PM »
Ok, I followed up with the distributor for TECO, and it looks like now I'm stuck with the Mach4 portion of this project:
I am not sure how to proceed with incomplete manuals.  I cant find documentation on this ModBus Plugin with Mach4.

Mach4 Scripting Manual.PDF
5.7 ModBus ....  Completely blank Chapter

Mach4 installation Manual.PDF
All Plugins included as Appendices.... Nothing for Modbus Plugin.

I have the registers now for the VFD that I need to write to, and I found the info for using LUA to script.

I need info for creating Modbus functions, what is the difference between:
Read Coils
Read Input Discreats
Read Input Registers
Read Holding Registers
Write Coils
Write Registers

Also, I need to know how to use one of these functions in LUA after i name it inside the MODBUS plug in.

This Is what I need to do:
1. Control Start/Stop   Write to Register 101H, Bit 0
2. Control FWD/ REV   Write to Register 101H, Bit 1
3. Set the Frequency   Write to Register 102H
4. Read the Frequency  Read Register 124H
5. Monitor the drive for error codes Read Register 121H
Re: Mach4 VFD Spindle setup
« Reply #4 on: February 16, 2016, 05:28:25 PM »
I found some really helpful info,

The name is what you would like to name the register.. In Mach4 you refer to the registers by name not by number!

The rest of it is:
Slave ID
Register (we have all the tables so sometimes you need to drop the first number.. for example I am working on a Mitsubishi drive now and I had to remove the 40000 because we know it should be in table 4.

Here are some examples of how I read and write:

Function from my RB1 to jog the head up by setting the HeadJogDir and HeadJogOn:
function HeadUp()
    local inst= mc.mcGetInstance();
    --Get the hReg handle of the modbus analog register
    local HeadUp = mc.mcRegGetHandle(inst, "modbus0/HeadJogDir");
    local HeadOn = mc.mcRegGetHandle(inst, "modbus0/HeadJogOn");

    if (HeadUp ~= 0 and HeadOn ~= 0) then
        mc.mcRegSetValue(HeadUp, 0);
        mc.mcRegSetValue(HeadOn, 1);

Reading the Hz from the inverter from the Hz register:
   local inst= mc.mcGetInstance();
    local Hz = 0;
    local HzReg = mc.mcRegGetHandle(inst, "modbus0/Hz");
    if (HzReg ~= 0) then
      Hz =  mc.mcRegGetValue(HzReg);

You can also set it to be an input or an output on a register.. The register types are important.. you need to select the correct type (this is a modbus standard)
Hope that helps..

I think this kind of answers my questions for a little while at least, Ill post back if I get stuck again.