Hello Guest it is April 25, 2024, 03:30:40 AM

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

Pages: 1
1
Mach SDK plugin questions and answers. / Mach4IPC.dll interop for C#
« on: December 21, 2021, 08:32:55 AM »
Does anybody have a Mach4IPC interop bindings library for C#?

2
Mach4 General Discussion / Modbus sending same register twice
« on: November 09, 2021, 01:56:39 PM »
Version 4.0.1.2259

I'm using the NewFangled modbus plugin to try to send X,Y,Z to an external data logger.  As configured there were two modbus devices, so I added a third.  I then set it up to send some registers using write multiple. Basically it's identical to one of the modbus configurations that writes to an on board PLC, but I'm also having it write to my own device.

The registers I'm trying to send are ContAxisPos1, ContAxisPos2, etc.  My modbus device is modbus2; modbus0 and modbus1 are PLCs on the machine.

Near as I can read, my modbus write function is identical to the one that writes to modbus0.  Same function code, same references. Very fast round trip time reported in Modbus Diagnostics (<5 msec).  The other end (my device) is receiving the messages no problem.  However, it's all zeros.

I can't figure out why when I look at modbus0 diagnostics ContAxisPos1 would have a value (say -118) but just below it trying to write the exact same register to device modbus2 that value (and all other values) is sending 0.  I confirmed with wireshark that's really what it's doing.

Is there any problem with trying to send the same register to two different places?


3
Mach4 General Discussion / Socket support
« on: October 30, 2021, 04:48:19 PM »
I have a machine that is running Mach4 version 4.0.1.2259 with some custom add-ons that were put in to control a laser.  It's an older version of Mach4, but it is a licensed version and unfortunately upgrading it is out of the question because of all the custom development that went into it.

I want to modify it to do something relatively simple (I think).  I want to write a lua script that runs either on a timer or creates its own thread with a timer.  I want it to get the mc object and periodically spit out some data via a UDP socket:

* What program (g-code file) is currently running
* Current spindle speeds
* Current X,Y,Z

I'm stuck trying to figure out how to do this.  I think an .mcs file is really just lua, so I thought I could download a copy of a luasockets dll and 'require' it, but that doesn't seem to work and I'm not sure why.

Is this approach even possible?  Or do I really need to develop a legitimate external plugin?  An .mcs file is just lua, right?  Is there any way to figure out what version of lua it is?

It does seem to have modbus included.  If what I'm trying to do won't work, then maybe there's a way to do the same thing by having it just push this data to a modbus device that happens to be my PC (running a tcp modbus server) rather than a PLC?

4
Mach4 General Discussion / Lua script for feeding OEE
« on: September 22, 2021, 12:14:35 PM »
I would like to get some basic operating state data (run state, is it estopped, maybe calculate cycle counts + cycles that ended in success or error) and get them out on to the network somehow, maybe via a socket.  Is Lua an appropriate way to do that?  It's Mach 4 Industrial build 2259.

5
Mach SDK plugin questions and answers. / Machine / Production State
« on: September 22, 2021, 09:24:19 AM »
I am trying to build a sort of OEE / KPI dashboard that should include this machine.  To do that, I need to somehow pull out the machine state.  I can see two possible ways to do this:

  - Via the DLL interface, i.e. the Plugin SDK
  - Via Modbus

I think the easiest way would be to do it using modbus, but to do that I think I would have to develop a simple brain that reads the machine status and then writes it to an external modbus device.  I have been searching the forums to try to figure out machine state and I found this:

   https://www.machsupport.com/forum/index.php/topic,36548.msg250379.html#msg250379

that lists a bunch of useful states: IDLE, RUN, JOG, HOME ... maybe that would be a good place to start.  From that, I think I could build a pretty simple cycle counter as well, and count the number of cycles that completed normally vs. ended in some kind of error.

My questions are:

  • Where can I find this machine state variables accessible from within a Brain?
  • If I use the SDK / DLL method instead, how do I access this MC_STATE?



Pages: 1