1
Mach4 General Discussion / Re: Mach4 VFD Spindle setup
« on: February 16, 2016, 05:28:25 PM »
I found some really helpful info,
I think this kind of answers my questions for a little while at least, Ill post back if I get stuck again.
Quote
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:
Code:
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);
end
end
Reading the Hz from the inverter from the Hz register:
Code:
local inst= mc.mcGetInstance();
local Hz = 0;
local HzReg = mc.mcRegGetHandle(inst, "modbus0/Hz");
if (HzReg ~= 0) then
Hz = mc.mcRegGetValue(HzReg);
end
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..
Brian
I think this kind of answers my questions for a little while at least, Ill post back if I get stuck again.