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 - smurph

571
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 13, 2014, 05:56:43 PM »
Graig,

You are adding two handles that sum to a number larger than a 16 bit register will take.  The internal Mach register can store that number easily.  But the 16 bit register in the PLC cannot.  It also looks like the Rhr3 is also part of a read function.  The internal Mach register will not get updated unless the value ON the PLC changes.  Yet is it possible to SET the value internally from the Mach side.  So if you wrote a number in the simulator register 40003, it would have changed the value in the Register Diagnostics window.

The correct way to do the register read is with two API calls.

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);

Rhr3 should == 24564 which is within the 16 bit range.


An enterprising LUA programmer can shorten the 2 API calls with something like this:

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

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

Those are hand written on-the-fly functions so they may not be totally correct.  But put something like them in the Screen load script and you can access them from any screen/object script. This will make things a bit easier in the code like:

local valRhr1 = ReadReg("modbud0/Rhr1");
local valRhr2 = ReadReg("modbud0/Rhr2");
WriteReg("modbud0/Rhr3" valRhr1 + valRhr2);

Steve

572
Mach4 General Discussion / Re: ScreenSet Question
« on: May 13, 2014, 02:49:42 AM »
The "Default" page is page 0.  The wxMach.set is not really designed to have multiple pages.  It uses tabs.  If you shrunk the tab(notebook) control down a bit and put buttons up there, you would see them on all of your pages.  But you would also see the notebook control so the screen design is not going to be what you want at all. 

I would start out with a new screen if you wanted "pages" in the Mach 3 sense.

Steve

573
Build 1767:

http://www.machsupport.com/wp-content/uploads/2014/04/Mach4Hobby%20Installer-1767.exe

The plugin file extensions have been changed from "dll" to "mp4w".
The keyboard plugin has been reworked to only affect the Mach GUI.  If Mach loses focus, the keyboard driven action/input will stop.  

Steve

574
Mach4 General Discussion / Re: Mach 4 Bug Reports
« on: May 13, 2014, 02:06:43 AM »
We are working on a shortest path provision for rotary.  Eventually tied into the Fanuc RINC parameter.  Looks like that code is switched on.  I'll turn it off in the next update.

Steve

575
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 12, 2014, 08:17:37 PM »
Here is a screen shot of where to put the register number.  It is the highlighted text field.  If you need to read multiple consecutive registers, then use a function that reads multiple regs.  Input the starting register in the highlighted field and then enter the number of regs to read in the count field.  The count includes the register defined in the register field.

If you don't need consecutive registers, then do separate single register functions.

Steve

576
Mach4 General Discussion / Re: Mach 4 Feature Request
« on: May 12, 2014, 03:39:23 PM »
I always set up the tools in the order that I use them.  My machine has a 16 pod Geneva.  So the most frequently used tools are entered from 1 to 16.  Then, my manual change tools are numbered 17 and up.  In my tool change script, if any tool is greater than 16, it goes into manual mode.  Is that not sufficient?

Steve

577
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 12, 2014, 12:40:40 PM »
1)  What config?  Modbus or Mach?
2)  Use the PLC script and scr.* API.
3)  I'm not getting this one.  Can you explain what you are wanting to do?
4)  Can you provide and example?  With say the Mod_RSSim modbus simulator?  I can set up connections to the simulator, not run the simulator (like the PLC is off) and it works fine.  
5)  I have never seen this!  I will try and find it.

BTW, some of the bug stuff needs to be posted in the bugs thread.  That way we can track it.

Steve

578
Thanks for the G9 Terry!  As for G81 and the others, I don't know.  I'll ask Brian.

Steve

579
That LARGE number is what we use for the NIL value.  The var needs to just show NIL instead of that value.  I'll add that in.

There is a pin button to make it always on top. 

Steve

580
Build 1762:

http://www.machsupport.com/wp-content/uploads/2014/04/Mach4Hobby%20Installer-1762.exe

Fix G81 error.
Added G code Vars to the mcRegFile plugin.  You can view the G code variables in the Diagnostic Window.
G code variables are saved when Mach 4 is shutdown.  Except local vars #1-#34 and global #100-#199.  All the rest should be sticky.
File->New for new file creation.  (also "Edit G Code" button will edit a new file if there is no file loaded.)
Operator->Jog Trace toggle so that the user can control if Jogs show a trace in the tool path.
Modbus bit packing mod re-inserted into the mcModbus plugin.  (it was there and then it wasn't.  Not it is back!)
Modbus RS485 check box now does something and it is sticky.
Every GUI control object now has an "Enabled States" property.  It allows for the object to easily be enabled/disabled via the machine state.
The clipboard is not destroyed in gcEdit and mcLuaEditor upon exit any more.

If you have modified your screen sets or profiles, make a backup before installing!

Steve