Hello Guest it is April 25, 2024, 03:38:35 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.


Messages - Ya-Nvr-No

401
Mach4 General Discussion / Re: ScreenSet Question
« on: May 12, 2014, 10:14:50 AM »
local inst= mc.mcGetInstance();
fro=mc.mcCntlSetFRO(inst, 100);





--paste in the click script

402
Mach4 General Discussion / Re: Signal Scripts
« on: May 11, 2014, 07:50:11 AM »
Update to my question on combining (concant) variable to output on one line
I put this in the "Signal Script" and it displays the Key signal number and the button state.
more for informational use and testing then anything at this time.
Note; (to display one "&" you have to use two)
the ".." is the concant function
several button spew out several lines, view in history

mc.mcCntlSetLastError(inst, 'Signal && State = ' .. tostring(sig) .. ' && ' .. tostring(state));

403
Mach4 General Discussion / Re: Signal Scripts
« on: May 10, 2014, 11:40:28 PM »
With the help of Illya and Brian

As an update for all, the script does not go into the PLC Script, it goes in the Screen Load Script.
works sweet now.

thanks guys


Code: [Select]
SigLib = {
   --Enable
    [mc.OSIG_MACHINE_ENABLED] = function (state)
        machEnabled = state;
    end,
    --HeadUp
    [mc.ISIG_INPUT1] = function (on_off)--mc.ISIG_INPUT1
        if( on_off==1 ) then
            -- On
        else
            -- Off
        end
    end,
    --HeadDn
    [mc.ISIG_INPUT2] = function (state)--mc.ISIG_INPUT2
        if( state == 1 ) then
            -- On
        else
            -- Off Call A function here if you wanted
        end
    end,
  [mc.ISIG_INPUT3] = function (state)--mc.ISIG_INPUT3 --Used as an enable button
        if( state == 1 ) then
            local inst= mc.mcGetInstance();
            local reg = mc.mcSignalGetHandle(inst, mc.OSIG_MACHINE_ENABLED)
            state = mc.mcSignalGetState(reg);
            if(state == 1)then
                state = 0
            else
                state = 1
            end
            mc.mcCntlEnable(inst, state);
        end
    end,
    [mc.ISIG_INPUT4] = function (state)--mc.ISIG_INPUT2 button to do feed hold
        if( state == 1 ) then
            local inst= mc.mcGetInstance();
            mc.mcCntlFeedHold(inst)
        end
    end,
    [mc.ISIG_INPUT5] = function (state)--mc.ISIG_INPUT5
        if( state == 1 ) then
            CycleStart() --Run my cycle start function
        end
    end,
    [mc.ISIG_INPUT6] = function (state)--mc.ISIG_INPUT6
        local inst = mc.mcGetInstance();--Tool Release Button
        local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT7);
      
        if( state==1 ) then
            --Check to see if the spindle is stopped here
            --Turn On Tool Release (Unclam Tool)
            mc.mcSignalSetState(hsig, 1 );        
       else
           --Turn Off Tool Release (Clamp Tool)
            mc.mcSignalSetState(hsig, 0 );
        end
    end
}



this still goes in the signal script:
if(SigLib[sig] ~= nil)then
SigLib[sig](state);
end

404
Mach4 General Discussion / Re: Mach 4 Bug Reports
« on: May 10, 2014, 03:19:13 PM »
No what I ment was that the button was only active while in the down position.
so button state is always 0 (off) unless pressed and held... that would create a state of 1 (on)
Then Id make all them Blue or Yellow for consistency
and if that function was being called in a program (air on) the button would change color as a visual feed back.
just a PLC script addition

Dont want to have to write scripts for a button down and a button up but if I have too.

your defining a ON or Off delay action depending on how the output is handled from the button press

405
Mach4 General Discussion / Re: Signal Scripts
« on: May 10, 2014, 02:26:01 PM »
if I leave this one line in the signal script I can see what button number is being pushed,
just not sure what all the other numbers that get displayed with some button presses represent.

note: and only if a script is associated with that button.

 mc.mcCntlSetLastError(inst, 'signal = ' .. tostring(sig));

406
Mach4 General Discussion / Re: Signal Scripts
« on: May 10, 2014, 01:48:14 PM »
I take that back, it works kind of,
only after you rem that section restart mach4 then take the rems marks out
then it works till you restart
so im getting closer but its not fully functional.


how do you display two or more variables on one line?
mc.mcCntlSetLastError(0, 'state  &  signal = ' .. tostring(state) "  " .. tostring(sig));

407
Mach4 General Discussion / Re: Signal Scripts
« on: May 10, 2014, 01:01:46 PM »
with the latest version of mach4 this signal script works now, thanks


mc.mcCntlSetLastError(0, 'sig1 = ' .. tostring(sig));
mc.mcCntlSetLastError(0, 'state1 = ' .. tostring(state));
if (SigLib[sig] ~= nil) then
   SigLib[sig](state);
        mc.mcCntlSetLastError(0, 'sig2 = ' .. tostring(sig));
        mc.mcCntlSetLastError(0, 'state2 = ' .. tostring(state));
end

you can see what button signal number
and 0 for off 1 for on

Still trying to get my head around it but at least it seems to be giving me something useful.

408
Tangent Corner / Re: Whoops !
« on: May 10, 2014, 11:45:47 AM »
So should we assume the train stays on the tracks when it hits this slight bump?
Or the hose is worth more than the derailment?

409
Mach4 General Discussion / Re: Mach 4 Bug Reports
« on: May 10, 2014, 11:36:58 AM »
Terry that makes perfect sense for the up down button script choices.
but, why not just make it a momentary action option button

Thanks

410
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 10, 2014, 10:47:00 AM »
The other issue I find is that I can only add 0 thru 31 outputs (mbo 0 thru 31)
on adding and using mbo32 it turns on address 2 in the simulation modbus Coil outputs
Nothing else can be added above 32 outputs (modbus configure limits me to 32 working outputs)