Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: thespindoctor on September 09, 2011, 08:05:29 PM

Title: digitize led on OemLed code
Post by: thespindoctor on September 09, 2011, 08:05:29 PM
I have a limit switch connected to my breakout board A axis home on port 1 pin 15 which is set to be a probe input in ports and pins in Mach.  When I trip the switch, the digitize led turns green on the Diagnostics page as it should.  I need to be able to recognize when the switch is tripped.  I have tried several GetOEMLED codes including 855, 852 and no joy.  What would be the correct one? Do I need the 60000 series codes now?

Thanks
Title: Re: digitize led on OemLed code
Post by: Overloaded on September 09, 2011, 08:27:02 PM
Try 825
Title: Re: digitize led on OemLed code
Post by: thespindoctor on September 09, 2011, 10:11:29 PM
thanks! i will try again but i don't think it works
Title: Re: digitize led on OemLed code
Post by: Overloaded on September 09, 2011, 10:53:16 PM
I was just guessing.
Not sure what you are wanting.
 You say "When I trip the switch, the digitize led turns green .............  I need to be able to recognize when the switch is tripped."
Where else do you need to "recognize" it ?
Title: Re: digitize led on OemLed code
Post by: Overloaded on September 09, 2011, 10:57:38 PM
The switch cannot be both "A" HOME and PROBE.
It could be Home and Limit though.
Maybe that is what you are wanting ?
????
I'm getting lost.
Title: Re: digitize led on OemLed code
Post by: BR549 on September 09, 2011, 11:48:07 PM
Perhaps if you explain exactly what it is you are trying to do someone could help.

Just a thought, (;-) TP
Title: Re: digitize led on OemLed code
Post by: thespindoctor on September 10, 2011, 05:27:53 AM
Sorry, I am trying to use the switch to touch off on a grinding wheel to get a tool offset.
Title: Re: digitize led on OemLed code
Post by: BR549 on September 10, 2011, 10:14:41 AM
OK easy enough set up the switch as a probe then just probe with the axis that holds the grinder wheel.  Use the G31 probing function to create the motion and capture the positional values with a CB script.

Are you trying to determene the wheel diameter or just trying to find the edge of the wheel?

IF just finding the edge of the wheel then set it up as a HOME then run the G28.1 gcode routine.

There are many ways to do just depends on your needs.

(;-) TP
Title: Re: digitize led on OemLed code
Post by: thespindoctor on September 10, 2011, 11:44:52 AM
Ok, now I am really frustrated!  The GetOEMLED() function does not function.  I can see on the Diag screen that
the Home led lights up so I put a led on my screen to probe the grinding wheel.  I wrote a program to move the
wheel until the switch trips.  The switch trips and the led illuminates but GetOEMLED(839) always returns a zero
or false. It does not matter where I use GetOEMLED() or how I use it - it is not working.  This must be a bug
of some kind where Mach is not communicating with this function.  GetOEMDRO() is working however.  I have
tested printing GetOEMLED(389) in loops with variables substituted and defined as integers etc and never can
get anything but zero.  The switch is set as Home A and the Diag screen Home A led is set to OEM 839.  Everything
looks correct except the basic function not working.  Any ideas?  Is there a way to reinstall or reactivate basic?
My program is something like this and GetOEMLED(839) is always false even after the switch trips and the diag led
is on.  It should go to true when the switch trips?

'output file opened to #1
Yval=.001
for i=1 to 100
code "G1 Y-" & Yval & "F1" 'moves toward switch at .001 increments
print #1, Yval, GetOEMLED(839) ' writes y position and led condition to file
Yval=Yval+.001
next i
Title: Re: digitize led on OemLed code
Post by: thespindoctor on September 10, 2011, 12:16:21 PM
Continuing on -  The switch is wired to A home and defined in ports and pins as A home not probe but it does
not work either as A home or as probe.
Title: Re: digitize led on OemLed code
Post by: thespindoctor on September 10, 2011, 11:28:03 PM
Fixed by adding While IsMoving  Wend