Hello Guest it is August 21, 2019, 10:28:13 AM

Author Topic: External LEDs to Indicate MPG1 Axis  (Read 4741 times)

0 Members and 1 Guest are viewing this topic.

External LEDs to Indicate MPG1 Axis
« on: January 30, 2011, 03:01:14 PM »
I wish to have 3 LEDs to indicate the axis driven by MPG1
I have set up the Mach3 Ports & Pins Outputs 1/2/3 to Port 10 and the PoKeys pin numbers 23/24/25 which have the LEDs
I have tested the PoKeys interface using a brain input of MPG JOG (OEMLED 57) and a brain output of Output 1. The LED on pin 23 goes on and off correctly in sync with the screen LED.

How do I input the 'MPG 1 Drives X Axis', 'MPG 1 Drives Y Axis', and 'MPG 1 Drives Z Axis' LEDs into the Brain as the OEM numbers 59/60/61 do not appear on the drop down menu?

Any help would be appreciated.

Offline poppabear

*
  • *
  •  2,231 2,231
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: External LEDs to Indicate MPG1 Axis
« Reply #1 on: January 30, 2011, 03:34:33 PM »
do a work around, in your macropump, look at those LEDs, then if they are on, map them to a ULED, and then in brains, map yoru uled to your putputs.

scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: External LEDs to Indicate MPG1 Axis
« Reply #2 on: January 31, 2011, 04:59:56 PM »
Scott
I have inserted the following macropump:
Dim MPGXLED
MPGXLED = GetOEMLED(59)
SetUserLED(2101,MPGXLED)
I have enabled the macropump in General Config and restarted Mach 3
I altered my brain input to OEMLED 2101 but the PoKeys LED stopped functioning (Couldn't see how to select a brain input of ULED 2101)

I have also tried SetUserLED(2023, MPGXLED) in the macropump to map directly to PoKeys, and altered the PoKeys Config Plugin to map this pin range. Still no LED activity.

Offline poppabear

*
  • *
  •  2,231 2,231
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: External LEDs to Indicate MPG1 Axis
« Reply #3 on: January 31, 2011, 06:38:50 PM »
Look at the PoKeys "OEM" screen set, you will see that the user leds range 2101 is used by the pokeys, so your macropump nad pokeys are fighting over the same range.

Do this Map your MPG leds to (ULED range 1501-1503, to represent x, y and z mpg axis that are on), in your macropump. BTW: after you think you have enabled your macro pump to run, DOUBLE CHECK after reboot that it did indeed RUN, ie. look on the gen config dialog and see if the macro pump check box is still ticked.

in your brain,

ULED1501->NoOp->"Your output, or other ULED" this run would for instance map XMPG LED (using the ULED1501 that was mapped from MP), to what ever you want to output that to.

NOTE: the PoKeys.set on the PoKeys, matrix pages has in labels what ULEDS it is using.....  in the Plugin config, you can "Remap" from the OEM ULED ranges to what ever range you want to, but just realize the PK OEM screen will not work if you map outside what the ULEDs it uses....

NOTE2: REMEMBER that when ever you modify a brian, while mach is runnig (and save it), you will HAVE to do a RELOAD all brains, and them make sure it is enabled!!!!! EACH and EVERY time you edit a brain!!!!!!!!

scott
« Last Edit: January 31, 2011, 06:40:56 PM by poppabear »
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: External LEDs to Indicate MPG1 Axis
« Reply #4 on: February 05, 2011, 03:47:48 PM »
Scott,
I interpreted your advice as follows:

Macropump code:
    MPGXLED = GetOEMLED(59)      ‘MPG drives X Axis LED
    SetUserLED(1501,MPGXLED)      
Brain code
    OEMLED:1501 --- No-Operation --- Output 1
Ports and Pins > Output Signals
    Output #1    Enabled     Port 10     Pin Number 25     Active Low
PoKeys55
    Pin 25 digital output
The LED does not work.

I believe the problem is in the macropump and I have spent several hours experimenting with just the X Axis.
If I programme the macropump as:
    MPGXLED = OEMLED(59)                    ‘MPG drives X Axis LED
    Set OEMDRO(800,MPGXLED)              ‘The X Axis DRO
The result is a 0 or -1 depending on whether the MPG drives X Axis LED is Off or On
This surprised me as I thought the Mach3 screen LEDs would output a binary 0 or 1.

I then wrote the following macropump test code:
    MPGXLED = GetOEMLED(59)      ‘MPG drives X Axis LED
    SetUserLED(1501, MPGXLED)      ‘Load User LED
    Var = GetUserLED(1501)      ’Read User LED
    SetOEMDRO(800,var)         ‘The X Axis DRO
The X Axis DRO stopped showing the digital value of the LED.
I then inserted logic to change the -1 to +1 and the X Axis DRO started working

I then rewrote my macro pump code as follows:

    MPGXLED = GetOEMLED(59)      ‘MPG drives X Axis LED
    If MPGXLED = -1 THEN
        MPGXLED = 1
    End If
    SetUserLED(1501,MPGXLED)      
The PoKeys LED started working correctly. Eureka!

I was also able to configure the PoKeys Plug-In and map pin 25 directly as follows:

    MPGXLED = GetOEMLED(59)      ‘MPG drives X Axis LED
    If MPGXLED = -1 THEN
        MPGXLED = 1
    End If
    SetUserLED(2024,MPGXLED)      ‘Direct pin 25 mapping.
The Po-Keys LED continued to work and indicated correctly after I inverted pin 25 in PoKeys.

It was a simple matter to duplicate the code for MPG drives Y Axis LED and the Z  Axis LED.

For someone who had not heard of the exciting world of macropumps or brains before, this forum topic has been an interesting and challenging learning experience.

Why does Mach 3 use 0 and -1 for its LED logic?
Re: External LEDs to Indicate MPG1 Axis
« Reply #5 on: June 27, 2011, 09:44:21 PM »
I use this code to do the same thing.

In pokeys0 Cfg:
Uled base range start # - 2001
Use ULED range 1 output - from 3 to 11
Invert Output - checked

In brain I have put:
OEMLED:59 - No Operation, Pass Signal - OEMLED:2004
OEMLED:60 - No Operation, Pass Signal - OEMLED:2005
OEMLED:61 - No Operation, Pass Signal - OEMLED:2006

I have connected LED's to 3.3V and connectors 4,5 and 6. Works perfectly. I don't think we need to go through macropump and assigning outputs on port 10 for that.

Zafar