Hello Guest it is April 25, 2024, 06:45:24 PM

Show Posts

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.


Topics - mark4

Pages: « 1 2 3 4 »
11
Mach4 General Discussion / A solution for more switches than inputs
« on: February 09, 2018, 10:33:25 PM »
Hello i havent posted for a while had different problem with controllers and function. this is where i am at i have a cnc control built around the Ethernet Smooth Stepper and the MB2. i added a pokeys board to make up extra inputs i needed. i tried to use it for mpg that didnt work so i put my mpg back to the ESS and continued to use the pokeys 56e for some simple inputs two rotary switches and three push buttons. also 9 led's. none of this worked i tried to update the firmware on the pokeys. i tried capacitors and resistors like the manual said. nothing worked i kept getting false triggering that is a problem when one of your switches is cycle start. so my next solution for not enough inputs. i realize i can use two inputs to make three if i do it like this first switch input one on. 2nd switch input 2 on. 3rd switch input one and two on at the same time however on switch three use two diodes so they cant back feed.
the same thing can be done with more my second rotary has 4 positions i use 3 inputs and two diodes. and three push buttons just to cover everything. electrically they work good i can see the led's on the MB2 light up exactly as they should. so here is my problems i just guessed at the diodes can anybody help me with what size diode to use for a 24v system set up like this. probably about switch timing but i dont know. 2nd lua script is something i am working on (side note some of the manuals and examples for lua look very different to do the same thing, confusing) so this is what i set up for the 3 push buttons in screen load script.
---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {
[mc.OSIG_MACHINE_ENABLED] = function (state)
    machEnabled = state;
    ButtonEnable()
end,
[mc.ISIG_INPUT1] = function (state)
    if (state == 1) then
        Cycle()
     end
end,
[mc.ISIG_INPUT2] = function (state)
    if (state == 1) then
        Cycle()
    end
end,

---------------------------------------------------------------
-- Cycle Start, Feed Hold, Cycle Stop function
---------------------------------------------------------------
function Cycle()
--function CycleStop()
    local hsig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1)
    local Input1, rc = mc.mcSignalGetState(hsig)
    local hsig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT2)
    local Input2, rc = mc.mcSignalGetState(hsig)
    --Cycle Stop
    if Input1 == 1 and Input2 == 1 then
    mc.mcCntlCycleStop(inst);
    mc.mcSpindleSetDirection(inst, 0);
    mc.mcCntlSetLastError(inst, "Cycle Stopped");
    end
    if Input1 == 0 and Input2 == 1 then
    mc.mcCntlFeedHold(0)
    end
    if Input1 == 1 and Input2 == 0 then
    --function CycleStart()
    local rc;
    local tab, rc = scr.GetProperty("MainTabs", "Current Tab")
    local tabG_Mdione, rc = scr.GetProperty("nbGCodeMDI1", "Current Tab")
    local tabG_Mditwo, rc = scr.GetProperty("nbGCodeMDI2", "Current Tab")
    --See if we have to do an MDI command and if so, which one
        if ((tonumber(tab) == 0 and tonumber(tabG_Mdione) == 1) or (tonumber(tab) == 2 and tonumber(tabG_Mditwo) == 1 )) then
            local state = mc.mcCntlGetState(inst);
            if (state == mc.MC_STATE_MRUN_MACROH) then
            mc.mcCntlCycleStart(inst);
            mc.mcCntlSetLastError(inst, "Do Cycle Start");
            else
                if (tonumber(tab) == 0) then  
                scr.ExecMdi('mdi1');
                mc.mcCntlSetLastError(inst, "Do MDI 1");
                else
                scr.ExecMdi('mdi2');
                mc.mcCntlSetLastError(inst, "Do MDI 2");
                end
            end
        elseif tonumber(tab) > 2 then --No G Code or MDI panel is displayed so Do Nothing
            mc.mcCntlSetLastError(inst, "Nothing to Start");
        else --Do CycleStart
            mc.mcCntlSetLastError(inst, "Do Cycle Start");
            mc.mcCntlCycleStart(inst);      
        end
    end
end

this works well and doesnt false start except when you press the third switch which is stop you can get a quick cycle start first then stop in the history i dont know if this is a problem or will be and it could be related to the diodes or i need to add a capacitor of .01 across my switches. i tried adjusting filtering but that didnt seem to help. i think the solution is in lua but i dont know enough lua. my next piece of code is for mpg jog X Y Z and A axis.

[mc.ISIG_INPUT4] = function (state)
    if (state == 1) then
        Mpg()
    end
end,
[mc.ISIG_INPUT5] = function (state)
    if (state == 1) then
        Mpg()
    end
end,
[mc.ISIG_INPUT6] = function (state)
    if (state == 1) then
        Mpg()
    end
---------------------------------------------------------------
--Mpg Axis Increment
---------------------------------------------------------------
function Mpg()
    local hsig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT4)
    local Rotary1, rc = mc.mcSignalGetState(hsig)
    local hsig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT5)
    local Rotary2, rc = mc.mcSignalGetState(hsig)
    local hsig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT6)
    local Rotary3, rc = mc.mcSignalGetState(hsig)
    --Mpg X
    if Rotary1 == 1 and Rotary2 == 0 and Rotary3 == 0 then --Mpg X
        mc.mcMpgSetAxis(inst,0,0)
        mc.mcCntlSetLastError(inst,"X Selected")
    elseif Rotary1 == 0 and Rotary2 == 1 and Rotary3 == 0 then --Mpg Y
        mc.mcMpgSetAxis(inst,0,1)
        mc.mcCntlSetLastError(inst,"Y Selected")
    elseif Rotary1 == 0 and Rotary2 == 0 and Rotary3 == 1 then --Mpg Z
        mc.mcMpgSetAxis(inst,0,2)
        mc.mcCntlSetLastError(inst,"Z Selected")
    elseif Rotary1 == 0 and Rotary2 == 1 and Rotary3 == 1 then --Mpg A
        mc.mcMpgSetAxis(inst,0,3)
        mc.mcCntlSetLastError(inst,"A Selected")
    elseif Rotary1 == 0 and Rotary2 == 0 and Rotary3 == 0 then --Mpg off
        mc.mcMpgSetAxis(inst,0,-1)
        mc.mcCntlSetLastError(inst,"No Axis Selected")
    end
end
i haven gotten to coding the last switch which is a rotary for increment x1 x10 x100. the mpg jog code works somewhat it will turn on X then Y then Z then A then go back as long as i dont go to fast. however it doesnt like to shut off mc.mcCntlSetLastError(inst,"No Axis Selected") i have only checked it with set last error so far my thought if it doesnt pass there how is it going to work. so i turn the switch to x then y then z then a then back fast slow ridiculous speed and is doesnt confuse to bad however it doenst like to shut off the last block of code i have done two ways as you see it and like this
else
        mc.mcMpgSetAxis(inst,0,-1)
        mc.mcCntlSetLastError(inst,"No Axis Selected")
    end
end
this was better in that i got "No Axis Selected" from the outer switches y z a if i moved quickly but when i was on X and turned it to off it stayed X axis selected or should i say it didnt change to no axis selected as X was just the last axis selected and the others could be slugish. i thought about using the PMC for ladder logic and for speed might solve my problem however after looking it over unless somebody helps me set up the first rung for one input on and two inputs off jogs mpg i havent the foggiest idea of how to do it. also there is probably a better way with screen load script or maybe i should be using plc and dont know it. if i /we can find a way to make this work i can have my full blown control with inputs for probe and spindle A B I encoder. and i am sure others can benefit from this solution. thank you
mark

12
Mach4 General Discussion / Goto work 0
« on: February 05, 2018, 02:15:17 PM »
Hello i have a puzzle. i am running a Ethernet Smooth Stepper with a MB2 and three AC servo drives on a small mill. i have another mill that is almost exactly the same it doesnt have this problem. history 1st i tried to install the latest mach4 release and the latest build on the smooth stepper. this worked until i tried to jog then it wouldnt jog above .01" if you tried i made like it was moving the dro's changed but the machine didnt move. note my setup has a relay set to run the oiler whenever and axis is moved the relay clicked on like it was moving. so after allot of back and fourth i decided to use mach4 install 3233 as this is on the other machine and works fine the problem with the mpg jogging went away. think i am home free think again.
now the mpg jog works in all increments. i can home to the index pulse. but when i try to goto zero the machine moves a small increment and bumps to an abrupt stop, if i hit the button again it will move another small increment and abrupt stop, if i hit the button the right amount of times with abrupt stops sometimes it will continue all the way to zero. note i am not doing z yet so just x and y. i can see the leds on the MB2 and havent seen anything wrong they all light up as expected no flicker except on the index pulse and that is expected. i have my own lua scripts and also was using a pokeys board but for my latest tests i went back to windows 7 mach4 build 3233 ESS build 216 no pokeys and installed a complete virgin mach4 with no script modifications. homing went well goto zero same problem. also i get no errors mach thinks it is doing the right thing. i turned on logging and am attaching file of homing, trying to goto zero, and on the last press actually going all the way to zero
if you have a work around know what i have done wrong or can just define the problem please help
i am desperate
thank you
mark

13
hello has anybody made or found a converter to convert a 0-10v signal to a +/-10v signal. it would work like this relay output fwd or rev then 0-10v convert so output is 0 to +10v for fwd or output is 0 to -10v for output that would open the way to control some of the older spindle controls that only have +/-10v i will probably make one it depends on an update to the controller i want to use if the update comes through as promised all will be well. if not then this will be my answer short term. i dont want to reinvent the wheel so if anybody has seen or done this??
thank you
mark

14
Mach4 General Discussion / tool changer tips and tricks
« on: September 29, 2017, 10:05:18 PM »
hi all i havent posted for a while just finishing a machine with a new controller and it fought me fyi if you have rf noise and you dont know where it is check that your fuses are all tight you have no idea how long it took me to find that and that was luck. onward i am doing a cincinati milicron mill with a 20? position tool changer and i have to write a tool change program in lua of course so i am going to write down the sequence and start programming but i was thinking i have written tool changers before with mostly good results but that was VB not lua. several concerns i have are the best way to go about an array or table for mach 4 to accomplish two things make sure mach knows which tool is where and the best way for the program to take the shortest route to the next tool. i have seen posts about tool changer programs some times they get help sometimes they dont. so i thought some of you have written tool changers or have some ideas and if you would post your insights would really help me to design the best tool changer or the problem spots you have had. this also might help others to write a tool changer i thank you in advance for any insight you might have and when i have finished writing the sequence of events i will post it.
mark

15
Mach4 General Discussion / lua error or is it
« on: September 12, 2017, 11:14:49 PM »
hello i was scripting and ran debug on plc script thats the first half then ran debug again thats the second half error on line 3. so i went back to basics straight install opened default mill profile went into edit ran the debug on a virgin plc script twice and this is what happened

Output: "C:\Users\Mark\AppData\Local\Temp\le1AF.mcc"
Waiting for client connection...
Client connected ok.
At Breakpoint line: 1 file: C:\Users\Mark\AppData\Local\Temp\le1AF.mcs
mcLua ERROR: Lua: Error while running chunk
[string "C:\Users\Mark\AppData\Local\Temp\le1AF.mcs"]:3: attempt to perform arithmetic on global 'testcount' (a nil value)
stack traceback:
   [string "C:\Users\Mark\AppData\Local\Temp\le1AF.mcs"]:3: in main chunk

so the question is it really an error or does the program just think it is. build 3233
thanks

Debug session finished.

16
Mach4 General Discussion / mach4 gcode editor
« on: September 08, 2017, 10:35:57 PM »
hi i was just wondering when i open the gcode editor it opens in a small window does anybody know how to make it open in a bigger window say one that doesnt take up the whole screen but that i can edit in like notepad. i tried to find the defaults to do this but no luck yet. thank you

17
Mach4 General Discussion / z axis and soft limits
« on: July 25, 2017, 09:46:02 PM »
hi all just upgrading as usual. i have been upgrading bridgeport mills for awhile servo and steppers just coming out with a stepper upgraded to ac servo its running sweet. the problem i have and this applies to all mills i have done mach 3 and 4 is what to set for z axis i have set -.125 for home offset soft min -5.00 soft max -.125 this works but i dont know if it works right. i have set max to zero and home to zero and other things experimenting but have never found the right answer that i am sure of. so i thought i would ask anybody who has set z soft limits on a mill what they came up with or can you tell me what is wrong with my approach thank you
mark

18
Mach4 General Discussion / index homing mach 4
« on: May 26, 2017, 11:08:12 PM »
hi all i have a quandry. i am upgrading a bridgeport to mach 4 with new ac servo drives a vfd the ethernet smooth stepper and the mb2 break out board which i absolutely love. the problem i have is not enough inputs but then you never have enough. so i built a daughter board to take the index signal 5v from my drives and convert it to 24vdc through an opto isolator this works fine. next i need to use only one input with my setup so i added a multiplexer to the daughter board i have plenty of outputs. i hooked two outputs to the daughter board with the mutliplexer and on/off combinations turn on the index from x y z a drives. the smooth stepper homes to the index perfectly. i need to set up the outputs so that when i am homing X a off b off, homing Y a on b off, homing Z b on a off, homing A a on b on and i havent the foggiest idea how to do this. i have been looking at the lua scripts and realize i do not understand how homing is programed. in mach 3 would have been change vb. so if anybody can assist me in this endever or point me in the right direction it would be much appreciated thank you
M  

19
Mach4 General Discussion / soft limits z axis mach 4
« on: February 24, 2017, 06:34:03 PM »
hello
z axis behaves strangely. i set it up soft min -5.00 soft max 0. home offset 0. i have also set it up soft max -.125 and home offset -.125. i have also set it up home offset .125 this worked even though it seems wrong i want to set z to move -.125 off the limit it doesnt seem to do this. if i set to home offset -.125 and home my machine will crash z if it doesnt it will still not work right. to me home offset -.125 makes sence if anybody has a fix or an explanation of why this is please. i am running a bridgeport stepper knee mill with ethernet smooth stepper and a cnc4pc c62 break out board thank you
mark

20
Mach4 General Discussion / oiler woes
« on: November 28, 2016, 10:45:00 PM »
hi all
i am retrofitting a bridgeport mill and the oiler is on an electric timer motor the timer orriginally ran when the spindle contactors were engaged. i have added a vfd and removed the contactors then added a relay to run the oiler. now with mach upgrade we can also probe and when probing the spindle doesnt run however we still need to run the oiler. mach 3 had a vb command ismoving and i have used this in the past effectively. i am trying to do the same with mach 4 but am still fuzzy on lua or you could say clueless. this is the code i have come up with.

if (machEnabled == 1) then
   runLube()
end
function runLube()
    local inst = mc.mcGetInstance()
    local hsig,rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT0)
    if (mc.mcCntlIsStill(inst)==1) then
        mc.mcSignalSetState(hsig, 0)
        wx.wxMessageBox("output 0 on")
    else
        mc.mcSignalSetState(hsig, 1)
        wx.wxMessageBox("output 0 off")
    end
end

this ran in plc script but didnt run when homing or when g-code was running, however when i jogged it ran as planned also i remmed out the message boxes when i saw the output working. i tried to get this to run in signal script without success. all i need is for it to turn on the output when an axis ismoving if you can help me thank you
mark

Pages: « 1 2 3 4 »