Hello Guest it is April 18, 2024, 08:22:37 PM

Author Topic: SetInputData() command  (Read 1961 times)

0 Members and 1 Guest are viewing this topic.

SetInputData() command
« on: December 20, 2020, 04:24:50 AM »
I have just bought a CNC mill which comes with Mach3. The control box includes an Ethernet SmoothStepper, and has sockets for both a tool-height setter and a touch probe. Both sockets are wired to separate pins on the ESS. The software included tool-height setting macros (which work fine) but no probing macros.

I have started work on probing macros but immediately found a problem with switching between ESS input pins - it's just not practical to go via "ports and pins" every time, but G31 always assumes the same probe input as defined in P&P. Eventually I discovered that the existing macros use the SetInputData() command to switch the probe "pin" before G31 calls. I have managed to make use of this by guessing the meaning of the parameters from comments in the code (including selecting active-low or active-high) but it would be useful to see some documentation on this function. Apart from one reference that suggests that this was introduced in .066, I have not found any information. Does anyone have any pointers?

Thanks,

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: SetInputData() command
« Reply #1 on: December 21, 2020, 03:46:54 AM »
sorry i have also no documentation about SetInputData() command, except that it is only supported by Version .066.
due the fact i was recomended by my Motion Controller supplier (CSLAB) not to use .066, i have made external locic
by optocuplers and relays do Switch via Outputs between probe Input sources to able to use more then one probe.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: SetInputData() command
« Reply #2 on: December 21, 2020, 10:25:05 AM »
On another machine I also used a CS Labs controller; I actually used .028 as there were a lot of problems with .066.

I have seen warnings suggesting that I should be using an older modified version of Mach3 to run on Windows 10 although I have not had any problems with W10 and .066 myself - and I need .066 for the SetDataInput() command!

For anyone who might be interested, as far as I can see (and this is all working on my own machine):

SetDataInput(a,b,c) takes 3 parameters

Parameter a appears to be related to the port number but I have no idea how this is calculated. I am using a=22 for port 2 on an Ethernet SmoothStepper - I have copied an existing value.

Parameter b is the pin number. I am using 13 and 15 for toolsetter and touch probe.

Parameter c is active low/high. From memory, c=1 is active high; c=0 is active low.

A call to this command will set the corresponding entries in the "Ports and Pins" table.

When I first started looking at this problem I considered an electronic solution. It only needs something like a Schmitt trigger on each input with possibly only a couple of diodes on the outputs to provide an OR function, to go to a single input pin. However, this is slightly more complicated as my input connectors are mounted on a PC board, so it is more difficult to fit this inside the cabinet, and I would need to find another 5V for an external box. No, none of this is impossible but is why I looked for a more convenient solution. I knew that the builders of this system could use both input ports; the problem was to find out how they did it! I also considered using a brain to OR together the input signals and take the result to a spare output pin on the ESS; I could then use a jumper to connect this to an adjacent input pin to use a source for the G31 probe operation. This did not work and it was while I was investigating why that I discovered the SetDataInput() command in a couple of the macros. It was these macros that meant that my brain/output-to-input solution did not work (as the macro kept switching the input pin) but did lead me to a purely software solution.