Hello Guest it is May 13, 2021, 03:10:10 AM

Author Topic: Help with Mach 4 controlling a PLC for tool changes.  (Read 11530 times)

0 Members and 1 Guest are viewing this topic.

Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #10 on: February 22, 2017, 04:46:39 PM »
Sorry, I've been busy at work.  Not been able to take screenshots of the machine. 
Chad Byrd
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #11 on: February 22, 2017, 04:58:57 PM »
No worries. I'm still trying to digest what you wrote. Plus I don't have access to my garage right now, getting a new driveway.
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #12 on: January 22, 2018, 12:04:55 AM »
Cbyrdtopper, thanks again for sending me all you did. I'm ready to revisit this issue. I've read through what you posted many times and now have a better handle on what I'm doing. I still have questions, but will play around with it first.
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #13 on: January 22, 2018, 01:31:16 AM »
Was thinking about this some more. I could use some more clarification. I'll break it down into two parts; setting up Mach for Modbus and the M6 Script. I take it that's all I need to do is those two things? I"ll worry about the tool change script last. I want to focus on the Modbus first.

First off if I'm using X001 as an input into my Click to trigger my tool change program and Mach Modbus directly works with Click as in your Example (i.e. Register 97) then do I have to use the DS#s? I figure when a tool change is called out in the Lua Script for tool changes Mach will send a signal to Click for X001 (register 97), which will run my Click tool change program. Then when Click receives an input for X006, click will send out an output signal to Mach (X006 is a proximity switch when tool changer is locked). Mach reads that input and knows the tool change was completed successfully and continues on with the rest of the tool change.

So first question, when Click receives a physical input, let's say X001, does Mach read that as an Input or Output?

So if all that makes sense then I don't need any outputs from Click because in my click program the inputs trigger the outputs. All Mach needs to do is send a signal to Click for that specific tool change and then wait for X006 input in Click.

So what Functions do I ned in Modbus in Mach Inputs and ?
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #14 on: January 23, 2018, 10:18:13 AM »
Cartierusm,
I ran into this problem when I was setting up the tool change on our Hurco VMC.  I don't think you can send an input from Mach to the Click; what I did was send an arbitrary output to the Click to start the tool change process.
Example:  
From the M6 Macro, turn on Output# (Y###) for 500ms and turn off
In the Click, when it reads the Y### set a bit (C#) that will latch the tool change sequence on.  When you are finished with the tool change sequence, reset this bit (C#).
The C# Bit will need to be in each rung of your tool change sequence.  If the C# Bit is not on then it will not run your tool change.
This is just how I did it and it works for us, there are more ways to accomplish this goal, I am by no means an expert on ladder logic.      

To answer your first question:  "So first question, when Click receives a physical input, let's say X001, does Mach read that as an Input or Output?"  
Mach will read X001 as an Input.  

"So if all that makes sense then I don't need any outputs from Click because in my click program the inputs trigger the outputs. All Mach needs to do is send a signal to Click for that specific tool change and then wait for X006 input in Click."
Like I first mentioned, You will need to setup Modbus Output to get your Tool Change Sequence started in the Click.  The Click will handle the I/O internally from that point on.

"So what Functions do I ned in Modbus in Mach Inputs and ?"
Use "Read Input Discreates" for Input  and "Write Coil" and/or "Force Multiple Coils" for outputs.
Chad Byrd
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #15 on: January 23, 2018, 01:36:23 PM »
Ok I think I'm getting it, maybe, possibly, ok maybe not. Just kidding. I'm starting to comprehend. Thanks for the help.

I don't need any other functions under Modbus in Mach, in your picture originally you have a whole bunch of functions, i.e. Carousel Pos, Write Request Carousel, Click CPU out, etc.., but you're saying I only need Read Input Discretes and Write Coil?



Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #16 on: January 23, 2018, 02:37:02 PM »
No worries, it takes a little bit to wrap your head around it.
I'm using registers to tell it which tool to go to, and now that I'm thinking about it, I guess you will also need to tell the Click WHICH tool to change to.  Is this correct?
Chad Byrd
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #17 on: January 23, 2018, 03:13:14 PM »
Right now I use a physical button going to click to make tool changes, i.e. X001-X008. That in turn triggers a C# as you mentioned that resets once the tool change is made. I just added in parallel to the X001 a Y101 for Mach to control. This way I can control the tool change manually or with Mach. Manually would only be when switching out tools.

I figure in the M6 I would tell Mach: For T0101 Output Y101 for 500ms, For T0202 Output Y102 for 500ms, etc... Then Mach would need to have specific X### inputs to verify the tool change has been made.

Can you answer what I asked previously, when setting up Modbus do I need all those functions as in your picture or just the read and write as you mention? Thanks.
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #18 on: January 23, 2018, 03:24:01 PM »
Using different Y Outputs from the M6 is a good idea.  Since you are going to do that, you don't need any of the register functions, you just need the Input and Output functions. 
Chad Byrd
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #19 on: January 23, 2018, 03:27:29 PM »
Ok great. Now I need to figure out how to program! I have very little idea of how to program M6. I guess it wouldn't be that difficult, right? If I find an example of a tool change sequence I can just repeat that for the other tools but change the inputs and outputs.

Do you mind posting the script you for the tool change or maybe an example of how to write it? If that's not too much trouble. I'll do my own research later today.