611
General Mach Discussion / Re: Is this possible?
« on: October 18, 2010, 06:53:14 PM »
There are some initial positioning and offset differences depending on which probe is used. A macro that runs at the beginning of the program sets all that up.
basically what I did was use a DPDT switch on the machine. One pole switches the two probe inputs and the other switches to ground when probe 1 is selected. That runs back to the controller where mach sees it as an input (Input 1). When my macro runs, it checks the state of input 1 and sets things up accordingly. It works very well.
My only concern is that I have an LED on screen for the two probes. Probe 1 is active when input 1 is active, so I have OEMLED 821 lit (true) when probe 1 is active. Basically, probe 2 is active when OEMLED 821 is false so no LED is really needed for probe 2, but for cool factor I wanted to add one. I added a userLED, then wrote a macropump that just sets it's state opposite that of OEMLED 821.
This works great, but I'm concerned about this piece of code running all the time and using valuable resources. It's just a simple if then else like this....
If getOEMLED(821) = False Then
setUserLED(1102, 1)
else
setUserLED(1102, 0)
end if
basically what I did was use a DPDT switch on the machine. One pole switches the two probe inputs and the other switches to ground when probe 1 is selected. That runs back to the controller where mach sees it as an input (Input 1). When my macro runs, it checks the state of input 1 and sets things up accordingly. It works very well.
My only concern is that I have an LED on screen for the two probes. Probe 1 is active when input 1 is active, so I have OEMLED 821 lit (true) when probe 1 is active. Basically, probe 2 is active when OEMLED 821 is false so no LED is really needed for probe 2, but for cool factor I wanted to add one. I added a userLED, then wrote a macropump that just sets it's state opposite that of OEMLED 821.
This works great, but I'm concerned about this piece of code running all the time and using valuable resources. It's just a simple if then else like this....
If getOEMLED(821) = False Then
setUserLED(1102, 1)
else
setUserLED(1102, 0)
end if