Hello Guest it is March 28, 2024, 10:38:48 AM

Author Topic: Adding more inputs or outputs to Mach3  (Read 4715 times)

0 Members and 1 Guest are viewing this topic.

Adding more inputs or outputs to Mach3
« on: May 06, 2020, 06:54:11 PM »
Hi All,

Is it possable to add more inputs and outputs to the system? The ports & pins section with the user defined inputs and outputs, there are from memory 15 user inputs and 20 user outputs. I need more to run my tool changer. I have two PCI cards in the computer with 64 input/output pins which work with mach3 but i can only access them by port3,x and port4,x    ie set output 1 to port3 pin 2 etc etc in the ports and pins setup.
Can i directly address the ports and pins in the VB coding without calling it output1?? or can i add more user inputs and outputs to the ports&pins menu??

Cheers,
Mark
Re: Adding more inputs or outputs to Mach3
« Reply #1 on: May 06, 2020, 08:22:27 PM »
Hi,
Machs parallel port can support two (only) ports.

Port one is set up with pins 2-9 as outputs and it is common to set up the second port with pins 2-9 as inputs.

Port 1 (2-9 as output) 12 outputs, 5 inputs
Port 2 (2-9 as input)   4 outputs, 13 inputs

Total: 16 outputs, 18 inputs

Is that enough?

If not then you will need an external motion controller:
Ethernet SmoothStepper 51 IO's
57CNC      57 IO's
UC300      85 IO's

Another possibility is to use a board like a 57E from PoKeys but NOT use it as primary motion control but as it as an auxillary
data input board. Note that such inputs cannot be used in realtime, each could have several hundred milli-second delays which may
screw your toolchanger.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Adding more inputs or outputs to Mach3
« Reply #2 on: May 06, 2020, 10:17:10 PM »
Hi Craig,

I have a Galil motion controller and two Contec PCI i/o cards with a total of 64 I/O i can use. the complete system has been working on Camsoft with tool changer but im changing to Mach3. I need to be able to access more inputs into mach3. The Contec cards work in Mach3 but i can only use input1 input2 input3 so on and so on. i need to be able to go input25 input26 etc.

or a VB script that lets me access the input directly, something like input (port3.bit25) ??

cheers,
Mark

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Adding more inputs or outputs to Mach3
« Reply #3 on: May 07, 2020, 02:05:03 AM »
for direct Access via VB script you have to get familar with API functions by using inpout32.dll

Code: [Select]
' API Funktionen der InpOut32.dll
Private Declare Function Inp Lib "inpout32.dll" Alias "Inp32" ( _
  ByVal PortAdress As Integer) As Integer


there are many examples avaliable on the Internet.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Adding more inputs or outputs to Mach3
« Reply #4 on: May 07, 2020, 03:59:39 AM »
did a Little bit of searching about These Contec PCI i/o cards , they have their own dll files to read the Inputs.

maybe the best way would be to run a Background thread witch reads the data and puts it into OEMLed's, then
you can read those in every script.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Adding more inputs or outputs to Mach3
« Reply #5 on: May 07, 2020, 05:31:06 AM »
ok cool, when you say thread do you mean another different program running in the back ground or a script running inside of mach3? im a little rusty on my VB, haven't used it in years.

All your help is very much appreciated.

Cheers,
Mark

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Adding more inputs or outputs to Mach3
« Reply #6 on: May 07, 2020, 07:13:59 AM »
i think macropump script can do this Job.
i dont know witch contec card's you have, but if they are port based something like this will read the data
and store it in UserLed's

Code: [Select]
  ' Our port address
  PortAddr = 1016 ' 0x3f8
  ' Read data register of parallel port at 0x3f8
  PortData = GetPortByte(PortAddr)
  ' write the data to OEMLed's
  SetUserLed(2001,PortData And &H01)
  SetUserLed(2002,PortData And &H02)
  SetUserLed(2003,PortData And &H04)
  SetUserLed(2004,PortData And &H08)
  SetUserLed(2005,PortData And &H10)
  SetUserLed(2006,PortData And &H20)
  SetUserLed(2007,PortData And &H40)
  SetUserLed(2008,PortData And &H80)
   
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Adding more inputs or outputs to Mach3
« Reply #7 on: May 07, 2020, 07:01:49 PM »
Thanks, I will give it a try.

Cheers,
Mark

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Adding more inputs or outputs to Mach3
« Reply #8 on: May 08, 2020, 01:40:14 AM »
ok but you to figure out first, witch port Adresses these Card are using.
my sample is only for 8 bit's so they must use more adresses.

do you know the type of the Cards?
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Adding more inputs or outputs to Mach3
« Reply #9 on: May 08, 2020, 04:39:31 AM »
Hi TPS,

I tried your code but it does not work. I have done lots of research and found the DLL and the documentation that goes with it. I have run a little test macro and the INIT works and returns the ID and no fault but fails on the DioOutBit. Ive attached the code and i think it is because of the modifier "Id As Short" Its not blue like Integer etc

Can you run VB.NET coding in the Macro ??

Cheers