Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: compewter_numerical on August 05, 2019, 07:46:20 PM

Title: Add More Software Input Signals
Post by: compewter_numerical on August 05, 2019, 07:46:20 PM
Hello,

I am wondering if it is possible to have more than the 64 available input signals in Mach4 and be able to map them to hardware signals.

(http://compewternumerical.com/ExtraInputs.PNG)

In other words have something like mc.ISIG_INPUT65 that is mapped to a hardware device like HICON P11 Input 8.

If possible, I would like to know how to do this using LUA and the Screen Editor.

Thanks for any help.
Title: Re: Add More Software Input Signals
Post by: Cbyrdtopper on August 05, 2019, 11:41:36 PM
I'm pretty sure that Mach4 can only have the allotted number as shown.
Are you really using 65 inputs?  If so, why don't you just add a PLC to your machine and let it handle a lot of your I/O?
Title: Re: Add More Software Input Signals
Post by: compewter_numerical on August 06, 2019, 05:51:49 PM
Thanks for the advice.

Yes we have over 70 inputs and about 40 outputs for the machines. Using a PLC would get complicated since we need to detect the state of the inputs in the M scripts in Mach4.

I think the solution we can use is create a ladder program in the PMC where if the hardware input changes, it writes a register and then we can read the register in the M script. We just need to figure out how to do this  ;D
Title: Re: Add More Software Input Signals
Post by: compewter_numerical on August 06, 2019, 07:03:31 PM
Looks like it is possible using the PMC.

(http://compewternumerical.com/EXTIOPMC.PNG)
Title: Re: Add More Software Input Signals
Post by: joeaverage on August 06, 2019, 08:41:45 PM
Hi,
that looks like you are able to address the registers.

The Hicon will have a stack of registers and you can access those but that is somewhat different to being able
to generate new signals in Machs core.

It would appear that a device plugin can register IO which thereafter behave like Mach Signals.....those IOs/Signals are 'owned' by
the device or plugin which registers them.

Craig
Title: Re: Add More Software Input Signals
Post by: compewter_numerical on August 09, 2019, 07:27:20 PM
It's definitely not the answer to the posted question but it is a solution to the problem.

I don't agree that limitations of software shouldn't be exceeded if there is a workaround available.

If I follow your answer to a previous post regarding custom iregs/gregs I can achieve the same thing without the HiCON plugin.

https://www.machsupport.com/forum/index.php?topic=38376.10
Title: Re: Add More Software Input Signals
Post by: joeaverage on August 09, 2019, 07:47:30 PM
Hi,

Quote
If I follow your answer to a previous post regarding custom iregs I can achieve the same thing without the HiCON plugin.

That is my understanding. You can create registers without restriction. They are accessible throughout Mach, irrespective of
which chunk, module, panel or whatever.

They are not a signal however. As you know whenever a Mach defined signal changes state the signal script runs. Thus you
don't have to monitor or poll the signals.....the signal script will run when any of them change and you can determine if
it is the signal you are interested in by having an entry in the signal library table (SigLib{}).

A register could change however and you would not know it unless you stopped what you were doing and read the register.
Thus if you had a number of inputs each attached to a register you would need to poll them on a regular basis to know if any of them
has changed. That could be a substantial program burden depending on the frequency which you determine you need to get
updates and on how efficient your code is.

Craig
Title: Re: Add More Software Input Signals
Post by: joeaverage on August 09, 2019, 07:59:20 PM
Hi,
just thinking about my previous post:

Quote
Thus if you had a number of inputs each attached to a register

How would you do that? If you have an input on the Hicon you have to signal it to Mach using a signal.....ie one of the signals
in Machs predefined list.....therafter you could update an iregs register. But having to use one of Machs signals rather defeats the
purpose.

I'm now thinking that using iregs is not a solution to your problem. Its not because iregs aren't useful...they certainly are but you
have to use a Mach signal to connect your input pin to an iregs register.

The Hicon obviously has a whole bunch of registers which it creates, at least one for every pin and without having to use one
of Machs signals. Is there any reason that you don't want to use the Hicon generated registers?.

The same caveat applies as before....you need to poll the registers for input events of interest.

Craig
Title: Re: Add More Software Input Signals
Post by: compewter_numerical on August 09, 2019, 08:08:44 PM

The Hicon obviously has a whole bunch of registers which it creates, at least one for every pin and without having to use one
of Machs signals. Is there any reason that you don't want to use the Hicon generated registers?.


For our solution we can use the PMC and the HiCON LED registers. The speed of the polling of the PMC can be tweaked to monitor the state fast enough, we've tested this here.

I was just mentioning that it is possible without the HiCON. We are only monitoring the state change in an M Script and we are using timer (or timeout) functions for each device it's monitoring.

For example we fire a clip into a part and check to see if the cylinder state changed. Or we send the device under a refill bowl and wait for a feeder release signal. We use modbus for all the inputs and haven't experienced any problems. But after adding additional components to the machine, we ran out of input signals in Mach4 and we have to improvise a solution. So far, the solution I mentioned has worked just like all the other inputs.
Title: Re: Add More Software Input Signals
Post by: compewter_numerical on August 28, 2019, 02:43:08 PM
Hi,
just thinking about my previous post:

Quote
Thus if you had a number of inputs each attached to a register

How would you do that? If you have an input on the Hicon you have to signal it to Mach using a signal.....ie one of the signals
in Machs predefined list.....therafter you could update an iregs register. But having to use one of Machs signals rather defeats the
purpose.

I'm now thinking that using iregs is not a solution to your problem. Its not because iregs aren't useful...they certainly are but you
have to use a Mach signal to connect your input pin to an iregs register.

The Hicon obviously has a whole bunch of registers which it creates, at least one for every pin and without having to use one
of Machs signals. Is there any reason that you don't want to use the Hicon generated registers?.

The same caveat applies as before....you need to poll the registers for input events of interest.

Craig

FWIW, the Mach4 iRegs/gRegs work fine for inputs monitored by the PMC. We switched away from the HiCON LED registers because we wanted unique names we could identify.

In our case, the PMC is monitoring the Modbus attached hardware inputs and writing the state to a register.

In an M script we check the value in the registers. We are not constantly checking the value of the registers. So far, there doesn't seem to be a loss of performance in Mach4. 
 
(http://compewternumerical.com/PMCConfig.PNG)