Hello Guest it is May 13, 2021, 02:43:18 AM

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

0 Members and 1 Guest are viewing this topic.

Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #60 on: January 30, 2018, 10:04:42 PM »
Who's lovin' Modbus??? Me. Thanks a bunch all of you. Lathe is a treat.

Assigning modus and getting it work with buttons in Mach 4 is actually rather easy. Took me all of like 5 minutes. Most of that was cut and paste of the script. Ran my first g-code with multiple tool changes just now. Pretty cool!

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #61 on: January 30, 2018, 10:54:58 PM »
 :)
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #62 on: January 31, 2018, 09:05:37 AM »
This has been a valuable learning experience, thanks to all who contributed to this post.
Job well done regarding the lathe Cartierusm, VERY nice !  ;)

I have one question for RT Chad and/or Brett. Thanks RT for contributing your M6 btw.
You initiate the PLC sequence by basically setting/resetting the physical output (Y1) with an output of Mach4.
Is there a particular reason for choosing a physical Y (output) at the PLC ?

I realize that that would work, but I typically send the output of one device to the input of the other.
If physical, I'd use an X input.
Being this is over ModBus, would using an internal flag, C bit to initiate the sequence work as well ?
This would free up all of the physical points, Y and X on the Click for other uses.
Just curious. Thanks,
Russ  :)


« Last Edit: January 31, 2018, 12:16:42 PM by Overloaded »
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #63 on: January 31, 2018, 10:41:53 AM »
I'm not sure why Chad used a Y, but I've found that Mach can at least read a Y output on a PLC and X. If you can find an address in your PLC software for an internal bit, I never looked, then I'm sure it can be done. I'm sure it must be as a PLC using Modbus can be pretty robust if using internal commands.

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #64 on: January 31, 2018, 11:22:57 AM »
I can't speak for Chads logic so can't say why he did it like that. I bet he explains it somewhere though. Might be he fires a physical output of the PLC from mach to start the tool change and when tool change is finished it turns that output off, telling Mach the tool change finished. This manual link could act as a pseudo watchdog in a way too...... maybe, just thinking out loud.

Yup, I would have the top section of my ladder setting the state of bits I could get and set through modbus. The bits would mirror the physical IO states. Then I would drive the outputs and read the inputs in Mach over modbus by changing or reading those bits. Hope that makes sense. This enables you to drive the tool changer through physical inputs or inputs over modbus from Mach.

;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #65 on: January 31, 2018, 12:11:09 PM »
Might be he fires a physical output of the PLC from mach to start the tool change and when tool change is finished it turns that output off, telling Mach the tool change finished.  
 


 --Send signal to the Click to start the tool change.
         mc.mcSignalSetState(ToolChange,1) --Y001
         wx.wxMilliSleep(1000)
         mc.mcSignalSetState(ToolChange,0) --Y001

Y1 is only ON for 1 second, just to initiate the PLC cycle. If I read it correctly. Then the Click would pulse a different bit back to M4 indicating completion of the cycle.

I like the second part of your post Brett, all the more reason to free up that "Y".

BTW, sorry ... I meant to name Chad in my inquiry instead of RT. (I have so many heroes, its difficult to keep them in order  :) )

Thanks guys,
Russ
« Last Edit: January 31, 2018, 12:12:49 PM by Overloaded »
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #66 on: January 31, 2018, 12:19:35 PM »
Hey guys,
I used Y because at the time I Didn't know I could send over different signals to the click.   I'm curious to see if I can enable a C bit to the Click over mosbus.   That would be my goto choice.   I will test this when I get home from Texas next week. 
Chad Byrd
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #67 on: January 31, 2018, 12:25:13 PM »
Excellent Chad, thanks for the reply.
I feel certain that it will work.
It works fine with Click -  ModBus between multiple AD products.
Let us know.
Thanks again,
Russ

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #68 on: January 31, 2018, 12:55:17 PM »
Quote
I like the second part of your post Brett, all the more reason to free up that "Y".

Yup, it does add some complexity to the ladder in the PLC but it does work nice. On some machines its not as big a benefit. But if the tool changer is attached to the gantry and the gantry has a 40 foot travel being able to do something like disable Mach (which puts the tool changer in the PLC in manual mode) and then work that tool changer with the manual tool change buttons attached to the gantry can be worth a lot over the life of a machine. On small machines its still nice to free up IO. Either way, in almost all cases its best to do things as efficient as possible.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Help with Mach 4 controlling a PLC for tool changes.
« Reply #69 on: January 31, 2018, 07:40:54 PM »
I'm not able to test this.  But just looking at the Click addressing, the C memory bits have a pretty clear address, so I don't see any reason why we won't be able to see changes in bits from the click as well as set them from Mach over modbus. 

The Y001 Output I used was an arbitrary output in the Click, it was totally unused and I could probably have used a memory bit for it(will test next week).  The only thing I lost was 1 of the 64 Mach4 outputs. 

I like the thought of having all the information being sent back and forth from the Click to Mach with bits.  It would make everything synced and truthfully act like a high dollar machine.  And with the way they have Modbus in Mach4, it would be very easy to do, it may take some time mind you, but it wouldn't be difficult. 
Chad Byrd