Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: sparkie.m 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
-
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
-
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
-
for direct Access via VB script you have to get familar with API functions by using inpout32.dll
' 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.
-
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.
-
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
-
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
' 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)
-
Thanks, I will give it a try.
Cheers,
Mark
-
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?
-
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
-
Sorry I mean variable type not modifier. :-[
-
Here is the CDIO.DLL file and the CDIO Help file I found if you want to have a try.
Cheers,
Mark
-
i think the Problem is that the variable Id is not specified
try a
Id = 0 at the begin of code
-
Hi TPS,
Yes i had tried that but with no luck. I have also done "dim Id as Integer" And I have changed the short to integer and to many other data types.
Mach3 talks to the cards fine in the Pins and ports setup and i can operate as many I/O as listed in the setup.
The PCI cards are listed as Port3 And Port4 in Mach3. so if i set Mach3 OUTPUT1 to Port3 pin1 then the card will output the pin1 on the first card. Can i link OEM buttons or LEDs to Mach3 ports and pins without the OUTPUT1 command.
ie OEMLED1 = port3.pin2 or something like that??
Cheers,
Mark
-
so if you are able to Access the Card via the regular port/pin Setup, they should be also be red/writeable via
GetPortByte(PortAddr)
and
PutPortByte(PortAddr)
as shown in this example i did
' 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)
you have to out in there the same port adress as in Mach3 setup
-
example to write UserLed's to a port
'example to write UserLed 2201-2208 to port
'Our port address
PortAddr = 1016 '0x3f8
PortData = 0
If (GetUserled(2201) = 1) Then
PortData = PortDate + 1
End If
If (GetUserled(2202) = 1) Then
PortData = PortDate + 2
End If
If (GetUserled(2203) = 1) Then
PortData = PortDate + 4
End If
If (GetUserled(2204) = 1) Then
PortData = PortDate + 8
End If
If (GetUserled(2205) = 1) Then
PortData = PortDate + 16
End If
If (GetUserled(2206) = 1) Then
PortData = PortDate + 32
End If
If (GetUserled(2207) = 1) Then
PortData = PortDate + 64
End If
If (GetUserled(2208) = 1) Then
PortData = PortDate + 128
End If
PortData = PutPortByte(PortAddr, PortData)
-
The cards are running through a Mach3 plugin to allow Mach3 to see them.
The port address in windows hardware manager are E480 for one card and E800 for the other card.
I tried these values with no success.
I think its only readable because of the plugin but dont really know. there is basically no information about the plugin but it allows for up to 4 cards so they must have made it to run over 100 odd inputs or outputs, i just do not know how to access them. There must be a way.
Cheers,
mark
-
I think the port get and put only work with the parallel port driver loaded.
-
do you have some more Information about the Cards and the plugin?
there must be way to get Access to These in- Outputs.
because, if the plugin get Access there must be a way to get access.
the plugin must reflect These IOs to somewhere,i think into modbus IO aeria, like all the other
Motion Controller do it.
-
The plugin is on the downloads page of mach3 website and the documentation is there also. there is even a forum like here too which ive also asked in but no response form anyone. The plugin is CONTEC. I have two CONTEC PIO-16/16T(PCI) cards in the computer. they are hooked to the tool changer and work perfectly in camsoft. Mach3 works with both cards when setting the ports/pins to OUTPUT#
I have attached all the info and some sample programs that came with the DLL file. You maybe able to make sense of it.
Cheers,
Mark
-
went trough all the files and did a lot of searching on the Inet, but all the Information about PIO-16/16 in combination
with mach3 is very Little. so maybe Steve Murphree witch is the programmer of the plugin is the only one witch
has more Information.
But btw are the In-/Outputs in Ports&Pins realy not enough?
for input's you have:
Input 1-4
OEMTrig 1-15 witch are 19
for output's you have:
Enable 1-6
Output 1-20 witch are 26
just a question.
-
Hi TPS,
Yeah unfortunately I need a few more than that. its using 32 inputs, not including motion stops and home switches etc (they are done on the Galil card) and 22 outputs. I might be able to trim away some inputs and maybe a few outputs. I could remove the automatic gear change and make it manual for starters. This old thing is covered with sensors for everything. It has a robot arm thing with a gripper to take the tool from the carousel and insert it into the spindle. each action has a sensor and motion solenoids. I may just make an Arduino controller to do the tool change and use RS232 serial from mach3 to send the tool value.
Thanks heaps for all your time and effort.
cheers,
Mark
-
anyhow it does not make sense to create a plugin, where you can select up to 4 of those IO Card's and then
you do not have Access to all I/O's. i am pretty sure that all the I/O's are reflected to somewhere. in the CSMIO,
witch i am using you can Access all the I/O's via the modbus functions GetInBit(adr,bit) and SetOutBit(adr,bit) and
ResetOutBit(adr, bit), but without more Information it is hard to find the right adress.
maybe you have a Chance to contact Steve Murphree via NFS Support?
-
I have spoken to the author of the plugin and mach3 can not use all the ports due to the limitation in Mach3s ports and pins table.