Hello Guest it is March 28, 2024, 05:06:06 AM

Author Topic: Mach 3: Programmatic change to config  (Read 5125 times)

0 Members and 1 Guest are viewing this topic.

Mach 3: Programmatic change to config
« on: March 19, 2021, 12:17:47 PM »
This is maybe a strange question, but I'm wanting to write a macro to add to a screen that will allow me to make repeated measurements on the probed position on executing a G31 - basically I am interested in the variance of the sensed position, or how accurate the probe is.  This is partly to evaluate probes, but more because what I'm actually wanting to do is evaluate the precision of photointerrupters sensing a vane.  At the moment my Mach 3 is set up to trigger on a negative going (i.e. grounded) signal when the probe touches which is fine for the photointerrupter when looking at one edge, but they also display hysteresis so I'd also like to look at the other sense, when the vane moves out of the gap and the signal goes positive.  What I'd really like to do is change the sensing polarity of the digitise signal from within the macro.  Can anyone advise if this is possible please?

John.
« Last Edit: March 19, 2021, 12:19:28 PM by JohnHaine »

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Mach 3: Programmatic change to config
« Reply #1 on: March 19, 2021, 01:33:25 PM »
you can try to Play with:

Code: [Select]

  SetProbeActive(bool) // turns the probe ON or off, 1 for on, 0 for off
  SetProbeState(bool) // sets the low-active on or off, 1 for on, 0 for off


never tested thse functions.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Mach 3: Programmatic change to config
« Reply #2 on: March 20, 2021, 02:15:16 AM »
Thanks for pointing these out.  The wording is a bit ambiguous on the second, does it mean if you set bool to 1 it's active low, or bool=0 it's active high?  I guess I might need to try it!

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Mach 3: Programmatic change to config
« Reply #3 on: March 20, 2021, 03:10:36 AM »
Code: [Select]

  SetProbeState(True) 'disable Active Low of probe input
  SetProbeState(False) 'enable Active Low of probe Input

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Mach 3: Programmatic change to config
« Reply #4 on: March 20, 2021, 05:36:23 AM »
Thanks!

I'll give that a whirl.

John.
Re: Mach 3: Programmatic change to config
« Reply #5 on: May 04, 2021, 09:56:27 AM »
Thanks!

I'll give that a whirl.

John.


Hello,

I am also looking for a way to switch the probe active low status without the need to open "ports and pins" tab. Did you try these commands? Do they work?


Thank you.

Best,
Alessio
Re: Mach 3: Programmatic change to config
« Reply #6 on: May 04, 2021, 10:32:54 AM »
Hi Alessio, I'm afraid not!  I managed to get the information I needed anyway.  If you try it I'd be very interested to know if it does work!

John.
Re: Mach 3: Programmatic change to config
« Reply #7 on: May 04, 2021, 10:53:18 AM »
Hi John, thanks for the reply. So how did you change the probe signal within the macros? Maybe I can use the same principle for my purpose.

Alessio
Re: Mach 3: Programmatic change to config
« Reply #8 on: May 04, 2021, 10:54:56 AM »
Well actually, I didn't - I just made measurements on one edge (falling edge) of the signal from the opto.
Re: Mach 3: Programmatic change to config
« Reply #9 on: May 04, 2021, 11:08:53 AM »
ah ok no problem. I will try those commands and report back if they work. There must be a way to change between pin status from a VB script or OEM command.
Thanks,

Alessio