Hello Guest it is April 25, 2024, 04:09:54 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

381
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 14, 2014, 11:35:25 AM »
I just focused on the functions and made sure it found my register values, pulled, computed and passed back the right value.

all done under a button I created to test.

I'm just adding the first and the second and putting the new value back in the first, basically an additive loop.
just to prove out how to do a modbus scripting feature.
now to figure out how to use the data and make bit wise decision.



found they did not really make a difference in my setup, so did not address them.
but going back, now that you reminded me of it, could be very useful.  :)
if you change them to the correct modbus0 name, as you step thru the function you can see them pass the values

local hRhr1 = mc.mcRegGetHandle(inst, "modbus0/Rhr1");
local valRhr1 = mc.mcRegGetValue(hRhr1);
local hRhr2 = mc.mcRegGetHandle(inst, "modbus0/Rhr2");
local valRhr2 = mc.mcRegGetValue(hRhr2);
local hRhr3 = mc.mcRegGetHandle(inst, "modbus0/Rhr3");
mc.mcRegSetValue(hRhr3, valRhr1 + valRhr2);


far as a m40
you would have to put the script in a m40.mcs file
then call it as a mcode
remember that you have to restart Mach4 to compile the new m40.mcs file
everytime you edit it.

382
Mach4 General Discussion / Re: ScreenSet Question
« on: May 14, 2014, 07:19:17 AM »
I wondered that too Russ but it was in the original signal script Brian provided so I thought id leave it to show, no discernible difference that I could tell under this application.

I too was pleased with Steve's post of what he envisioned the final screen designer would provide.

Terry if we provide some of the basic screen functions, experiment and share, the sooner Mach4 will be a reality. There are still a lot of motion control programming going on that might take some time (or you would be really "Fitchen a bitch" if canned cycles dont work). Having a community create what they envision and then share back will give all the basic screens the community is desiring. This Mach4 project, they (small team) took on, has taken them way, way more time then they prayed for. Id kind of like them to feel that we appreciate their huge task but we want it now.

Plus we get the damn thing done.

If nothing else your learning something new and that's never bad. You had to learn VB, brains, gcode, macro B (try learning A "what a pita that was")

Hopefully the examples posted will inspire you & others to experiment and provide more contributions.

Think Mach4 could be monitoring home/shop security thru a separate hardware unit at the same time your cutting chips. You just provide a functional way & screen for your own needs. Its not for every one, but this is 21st Century and these new kids do things a whole lot different than we use too.

Do they still have apprenticeships anymore? or is it just put them on the line and show em what buttons to push. Dont get me started on the way shops run.

But in the end I know your just pushing buttons for them to get it done ;) me too  8)

383
Mach4 General Discussion / Re: ScreenSet Question
« on: May 13, 2014, 09:43:14 PM »
 HOT KEYS WORK  ;D just have to restart mach4 to get to work
--edited the SigLib section of the page load script
--added two hot keys in the config plugins keyboard option shutdown restart and then config mach plugin and associate each to input 1 and input 2

    [mc.ISIG_INPUT1] = function (on_off)--mc.ISIG_INPUT1
        if( on_off==1 ) then
            -- On
             froup();
        else
            -- Off
        end
    end,

    [mc.ISIG_INPUT2] = function (state)--mc.ISIG_INPUT2
        if( state == 1 ) then
            -- On
            frodown();
        else
            -- Off
        end
    end,

384
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 13, 2014, 08:51:17 PM »
local inst= mc.mcGetInstance();

local hRhr1 = mc.mcRegGetHandle(inst, "modbud0/Rhr1");
local valRhr1 = mc.mcRegGetValue(hRhr1);
local hRhr2 = mc.mcRegGetHandle(inst, "modbud0/Rhr2");
local valRhr2 = mc.mcRegGetValue(hRhr2);
local hRhr3 = mc.mcRegGetHandle(inst, "modbud0/Rhr3");
mc.mcRegSetValue(hRhr3, valRhr1 + valRhr2);

function ReadReg(regName)
    local hReg = mc.mcRegGetHandle(inst, regName);
    local val = mc.mcRegGetValue(hReg);
    return(val);
end

function WriteReg(regName, val)
    local hReg = mc.mcRegGetHandle(inst, regName);
    mc.mcRegSetValue(hReg, val);
end

valRhr1 = ReadReg("modbus0/Rhr1");
valRhr2 = ReadReg("modbus0/Rhr2");
WriteReg("modbus0/Wsr1", valRhr1 + valRhr2);


--works thanks

385
Mach4 General Discussion / Re: ScreenSet Question
« on: May 13, 2014, 07:50:27 PM »
--Screen Load Script

fro=100

function froup()
    fro = fro + 10;
end
function frodown()
    fro = fro - 10;
end
function fro100()
    local inst = mc.mcGetInstance();
    fro=100
    mc.mcCntlSetFRO(inst, fro);
end

create the buttons, and on a button click put for each button one of the following
frodown()
froup()
fr100()

--now to work on the hot keys


386
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 13, 2014, 07:40:16 PM »
Thanks Steve

I knew that, but a bad example gets more attention  >:D

time to play and learn
thanks again

387
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 13, 2014, 02:08:04 PM »
 :-X ty
cool... now to get the scripting to work
something worked kind of in my messing around

388
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 13, 2014, 10:41:40 AM »
modbus reading registers from the simulator

how do to write to the simulator is the next challenge.

389
Mach4 General Discussion / Re: ScreenSet Question
« on: May 13, 2014, 08:41:45 AM »
I've wondered that too
wondering how do you copy and paste data from one screen set to another
what if I want to copy a whole tab or page from one screen to another.
but I wonder if the inst is the key as you open others the inst gets a new value
as I've never see it anything other than 0

matter of fact it wont let you open more than on at a time gives you an error

390
Mach4 General Discussion / Re: ScreenSet Question
« on: May 13, 2014, 08:10:38 AM »
I had to cut and paste everything out of the first page, too the added pages I had created. Thus leaving nothing in the first named page in the tree (default or page0 whatever you named it) But yes I would like some kind of sorting or moving of items, would make it better to organize and find things.