Hello Guest it is March 28, 2024, 05:42:09 PM

Author Topic: Which output signal is which?  (Read 952 times)

0 Members and 1 Guest are viewing this topic.

Which output signal is which?
« on: June 20, 2021, 01:50:14 PM »
I built a manual control panel and installed it like this:

https://www.machsupport.com/forum/index.php?topic=44875.new#new

Figuring out which INPUT was which was straightforward, but I'm having a time figuring out which OUTPUT is which from an API perspective.

I have 3 LEDs PROGRAM RUN, FEED HOLD, JOG HANDLE ACTIVE.

The intent is:

1. If the manual jog handle is activated, turn on the JOG HANDLE ACTIVE light. If the manual jog handle is not active, turn it out. On-screen jogging should work when manual jogging is disabled;

2. If a program is running, turn on the PROGRAM RUN light;

3. If a program is running and "FEED HOLD" (either the physical button or the on-screen button) is pressed, turn off the PROGRAM RUN light and turn on the FEED HOLD light;

4. If a program is running and in "FEED HOLD" state, and CYCLE START is pressed again, resume the feed, turn on the PROGRAM RUN light and turn off the FEED HOLD light;

5. If a program is running and in "FEED HOLD" state, and FEED HOLD (either the physical button or the on-screen button) stop the program and turn off the FEED HOLD light; and

6. For bonus points. if the program is waiting for a CYCLE START input, (like on a tool change) flash the PROGRAM RUN light.

In the motion control section, I connected the ESS output signals to the built-in signals PROGRAM RUN, FEED HOLD, and JOG ACTIVE thinking that Mach might manage all this for me, but no such luck. So now I want to set the signals directly from the code.

But the relationship between the output signal name and its index number is not obvious. How do I know which signal corresponds to what signal number? Is there a table somewhere?
Re: Which output signal is which?
« Reply #1 on: June 21, 2021, 03:51:36 AM »
These outputs will help, but the gcode running does not turn off when feed hold is active.

Gcode Running = mc.OSIG_RUNNING_GCODE
Feed Hold = mc.OSIG_FEEDHOLD

For the manual jog you may just have to use a normal output as there is OSIG_JOG_ENABLED but this would activate no matter where it was turned on from.

Re: Which output signal is which?
« Reply #2 on: June 21, 2021, 07:09:11 AM »
Quote
For the manual jog you may just have to use a normal output as there is OSIG_JOG_ENABLED but this would activate no matter where it was turned on from.

Except that it doesn't - I have that signal configured, and while the jog handle works great, the light doesn't come on.

There is some weird interplay between on-screen jog and manual jog too, but that's a stage 2 problem.

How do I assign an output so I can reach it like this:

Code: [Select]
local hJogLight
hJogLight, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1) --TODO set correct signal number

It was obvious how inputs correspond to input numbers (ie, which input is input 1, 2, 3 etc) but not so much with outputs.
Re: Which output signal is which?
« Reply #3 on: June 21, 2021, 07:28:11 AM »
You would just map 'Gcode Running' signal in the ESS config to the output you have the LED connected to. Same with the Feed hold.

You shouldn't need to do anything with lua to turn the LEDs on as these outputs should activate automatically when mach is either running gcode or in feed hold.
Re: Which output signal is which?
« Reply #4 on: June 28, 2021, 10:26:31 AM »
I swear those lights (feed hold and program running) weren't working previously, but last night I did some testing and now they are.

Jog isn't; that I will track down later.

Re: Which output signal is which?
« Reply #5 on: June 29, 2021, 09:40:22 AM »
OK, by remapping the jog light output from JOG ACTIVE to Output 5, and programmatically setting it in the signal library screen load script, I got the job light working as I wanted.

Now the second problem - is there any way to read/set outputs like PROGRAM RUNNING / FEED HOLD from within the API, or to assign them an output number?
Re: Which output signal is which?
« Reply #6 on: July 02, 2021, 01:34:23 PM »
A nifty trick is to assign the LED to a numbered output, then put signal handling code in he signal library to watch Mach's native signals.