301
Mach4 General Discussion / Re: Screen Set Ideas
« on: June 15, 2014, 10:51:27 PM »
playing around with modbus by passing data in, computing to display results
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
function fro100()
local inst = mc.mcGetInstance();
fro = 100
mc.mcCntlSetFRO(inst, fro);
end
function sro100()
local inst = mc.mcGetInstance();
sro = 1;
mc.mcSpindleSetOverride(inst, sro);
end
local chkVar3 = ReadReg("iRegs0/xscale");
if (chk3 ~= chkVar3) then
chk3 = chkVar3
if (chkVar3 ~= 1) then
code = string.format("G51 X%0.4f",tostring(chkVar3));
scr.SetProperty('droX1', 'Fg Color', 'Red');
else
code = string.format("G50");
scr.SetProperty('droX1', 'Fg Color', 'Green');
end
mc.mcCntlGcodeExecute(inst, code);
end
messages();
function messages()
err = mc.mcCntlGetLastError(inst);
if (err ~= errold) then
errold = err;
file = io.open("messages.txt","a") -- open a new current file
file:write(os.date("%x %X ")..(err).."\n")
file:close() -- close current file
end
end
function TestDSC_Module()
local StateOfInputSig0 = DSC.GetInput(0); --GetInput(InputSig), InputSig is a # 0-63 i.e. ISIG_INPUT0 is "0" (zero)
--a sequential Input 0-63
local StateOfDigitize = DSC.GetOtherInput('DIGITIZE');--active when X axis jogging Pos Dir.
--a non sequential/named Input, controlled
--from keyboard plugin
if StateOfDigitize == 1 then
local DigitalTrigger = 1;
DSC.OutputMiscSig('DIGTRIGGER', DigitalTrigger);
getprobedata();
else
SETFLAG = 0;
SETFLAG2 = 0;
end
end
TestDSC_Module();
function getprobedata()
local inst = mc.mcGetInstance();
local Xval = ReadReg("iRegs0/Xvalue");
local Yval = ReadReg("iRegs0/Yvalue");
local Zval = ReadReg("iRegs0/Zvalue");
gcodecapture = string.format ("X%.4f, Y%.4f, Z%.4f \n", Xval, Yval, Zval);
filename = "myProbeFile.txt";
if (gcodecapture == gcodeold) then
gcodeold = gcodecapture;
SETFLAG=1;
else
if (SETFLAG == 0) then
mc.mcCntlEStop(inst)
if (SETFLAG2 == 0) then
--mc.mcCntlSetLastError(inst, 'SETFLAG0 = ' .. tostring(SETFLAG));
file = io.open(filename,"a"); -- create new file or add to it
gcodeold = string.format ("X%.4f, Y%.4f, Z%.4f \n", Xval, Yval, Zval);
file:write(gcodecapture)
file:close()
gcodeold = gcodecapture;
SETFLAG2=1;
mc.mcCntlSetLastError(inst, 'gcodecapture = ' .. tostring(gcodecapture));
end
DSC.DoFunc('CNTLENBL');
end
end
end