Author Topic: Different types of probe connections (NO vs NC)  (Read 6689 times)

Mike Abbott

  • Posts: 33
    • View Profile
Different types of probe connections (NO vs NC)
« on: December 08, 2016, 06:47:37 PM »
Figured I'd start a new thread on this but I have a touch probe that works relatively well as far as I can tell (other than it has to go fast enough but that's another story).  That probe has NC contacts but my other probe for setting Z is NO (simple touch plate) so switching back and forth is a bit of a pain.  I was thinking of various ways to get around that other than going into mach4 and setting the input to either active high or low depending on the probe being used.  Only thing I can think of is a small transistor based circuit but figured I'd ask here before I break out my breadboard and start tinkering.

Mike

Bob at PMDX

  • Administrator
  • Posts: 368
    • View Profile
    • PMDX
Re: Different types of probe connections (NO vs NC)
« Reply #1 on: December 09, 2016, 02:29:24 AM »
For now your choices are to add an inverter such as the transistor circuit you mention, or try to create a Lua script that changes the polarity of the PROBE input.  I don't *know* that this can be done in Lua, but I see function calls that should make it possible.  See the Mach4HobbyDocsMach4CoreAPI.chm file and look in the "API Reference by Category", then in "Mach Signals" for functions mcSignalGetInfo and mcSignalSetActiveLow.  You will most likely need to make sure Mach4 is disabled when you call the "set" function.  And there may other functions you need to call, such as in the "GUI" section, the ncCntlConfigStrart (before you can call the "set" function) and mcCntlConfigEnd (when you are done making changes).

There is a facility in Mach4 to support multiple probe inputs (4 in total), with each one able to have its own active high/low setting.  On the Mach4 configuration dialog in the "Input Signals" tab there is a "PROBE" input, which you are currently using.  If you scroll further down you will see "PROBE1", "PROBE2" and "PROBE3".  The G31 command uses the "PROBE" input.  Mach4 added "G31.1", "G31.2" and "G31.3" variants to use the "PROBE1", "PROBE2" and "PROBE3" inputs, respectively.

Alas, the SmartBOB plug-in does not yet support the additional 3 probe inputs nor the G31.x variants.

Bob
Engineering Hell: Everything's right and nothing works.
Bob's Corollary: If everything's right and nothing works, double check your assumptions.

Mike Abbott

  • Posts: 33
    • View Profile
Re: Different types of probe connections (NO vs NC)
« Reply #2 on: December 14, 2016, 08:45:08 PM »
As it turns out, the simplest method is to use the Lua script option.  There is a spare empty button on the main screen so I used it for the toggle probe function and just set the button to toggle the input activelow state.  On experimenting, you don't have to be disabled to do it but I did limit it to only function in an idle state.  Was a bit surprised that it even saves the state it's toggled to in the .ini file.

Mike

Bob at PMDX

  • Administrator
  • Posts: 368
    • View Profile
    • PMDX
Re: Different types of probe connections (NO vs NC)
« Reply #3 on: December 15, 2016, 09:59:29 PM »
As it turns out, the simplest method is to use the Lua script option.  There is a spare empty button on the main screen so I used it for the toggle probe function and just set the button to toggle the input activelow state.  On experimenting, you don't have to be disabled to do it but I did limit it to only function in an idle state.  Was a bit surprised that it even saves the state it's toggled to in the .ini file.
Are you calling mcCntlConfigStart() before you change the polarity?  And mcCntlConfigStop() afterwards?  These function calls are necessary to tell the SmartBOB plug-in that the configuration has changed.  If you are not calling these functions, the plug-in and SmartBOB device will no know the configuration has changed and they will continue to use the original setting.  And since the probe "touch" detection is done in the SmartBOB device, it will not work for the probe after your Lua script toggles the polarity.

The SmartBOB plug-in only sees changes in configuration when you:
(1) Start Mach
or
(2) Open any configuration screen and then close it, which causes the Mach4 core to send all plug-ins an "end of configuration" message which tells us that we need to re-read the config data.
or
(3) A plug-in or Lua script calls mcCntlConfigStart() and mcCntlConfigStop() (which generates the "end of configuration" message just like a configuration dialog does.

Bob
Engineering Hell: Everything's right and nothing works.
Bob's Corollary: If everything's right and nothing works, double check your assumptions.