Hello Guest it is April 16, 2024, 02:55:07 PM

Author Topic: Lathe turret, VB, PLC, MODBUS, Position  (Read 16841 times)

0 Members and 1 Guest are viewing this topic.

Lathe turret, VB, PLC, MODBUS, Position
« on: November 16, 2009, 11:42:04 AM »
Hi all,

Thanks to everyone's help I am making good progress on the Takisawa turret.  I've got all the I-O wired and have a CLICK PLC wired up and communicating with MACH.  Also the power side is up and running, the motor relays are happy....  I have a few questions that maybe some folks could help with, any comments would be appreciated :-)

1-  I am having trouble with the idea of home switches and separate coordinate systems.  This may expose some ignorance on my part, but on my other machines I have no home switches and never change between coordinate systems, just zero the machine on the part and go.  Now I want the tool change to take place at the same spot all the time without having to zero off anything but the home switches, I think....  Anybody have a good explanation of this?

2- Another conceptual issue I am having is with communication between Mach and the PLC via VB scripts.  What it looks like others have done is write a ladder in the PLC and have Mach write a bit to the PLC to initiate that ladder program.  In other words Mach communicates with the PLC with single bits like I-O instead of sending some sort of commands?  I've read through a lot of posts on here and that seems like the idea but I wanted to see what folks think before assuming that is how it works. 

3-I think I want to avoid Brains for this one, is that a good idea?

4- When setting up the MODBUS, the dialogue box will not go away.  If you hit OK it just goes to the bottom left of the screen and stays there?  Is this abnormal?

OK, hope that's not too much stuff....  I will post some more images in show and tell one of these days, it is looking good.
Thanks so much,
Dustin

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #1 on: November 16, 2009, 02:14:06 PM »
1-  I am having trouble with the idea of home switches and separate coordinate systems.  This may expose some ignorance on my part, but on my other machines I have no home switches and never change between coordinate systems, just zero the machine on the part and go.  Now I want the tool change to take place at the same spot all the time without having to zero off anything but the home switches, I think....  Anybody have a good explanation of this?

I never use the work offsets in turn,  I just stick to G54,  but some do.
Tool offsets however are a must if you have a turret :)
How accurate yours will be will depend on the accuracy of your homing. I do the homing external to Mach, my drives are cabable of homing to a mechanical switch then once it is seen the drive will look for the encoders index pulse and gate it with A and B channels, this makes it extremely accurate. If your drives do not have that feature then I would suggest that either very high quality mechanical switches or optical switches would be the way to go. If using opticals you will have to house them in a waterproof casing and just have a trigger rod coming out of the box via an 0 Ring seal or similar.



2- Another conceptual issue I am having is with communication between Mach and the PLC via VB scripts.  What it looks like others have done is write a ladder in the PLC and have Mach write a bit to the PLC to initiate that ladder program.  In other words Mach communicates with the PLC with single bits like I-O instead of sending some sort of commands?  I've read through a lot of posts on here and that seems like the idea but I wanted to see what folks think before assuming that is how it works. 

Yes thats it, the PLC does the tool change but Mach tells it when to start and which tool to go to, once there the PLC then tells Mach its done and the macro finishes and allows Mach to carry on.


3-I think I want to avoid Brains for this one, is that a good idea?

Not keen on Brains myself for anything like this, fine for FRO or SRO etc but thats just me, others use Brains for toolchanging.



4- When setting up the MODBUS, the dialogue box will not go away.  If you hit OK it just goes to the bottom left of the screen and stays there?  Is this abnormal?

Thats normal, it will be gone the next time you start Mach, well unless you open it again ;D

Hood
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #2 on: November 16, 2009, 04:15:10 PM »
Hi Dustin,

All your VB script stuff should be in your M6Start macro. You will need to use a brain to transfer info between the M6 start macro and the modbus config data areas.

Basically your M6 start macro should indicate to the plc what tool it wants, then the plc does its stuff and returns after it is done with a success or error status.

If this is not clear, let me know?

Cheers,

Peter.
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #3 on: November 16, 2009, 04:26:05 PM »
Peter, how do the click PLC's connect to modbus, serial? TCP?
I use a D0-06 and the old style serial interface and there is no need for a Brain.

Hood
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #4 on: November 16, 2009, 04:43:50 PM »
Hi Peter, Hood,

Thanks Peter, I think it is clear, I need to spend some hours with it and get in further.  What I think you are saying is that I will need to use brains to allocate PLC addresses to Mach inputs, or something similar....

Hood, the CLICK I have is hooked up with a serial cable.  It is the DB 9 pin at the computer and a phone cord at the PLC.

Thank you,
Dustin
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #5 on: November 16, 2009, 04:47:22 PM »
Hood, Thanks for the information, I need to look into the G54 and tool offsets a bit....  I guess I don't care if the home switches are accurate, I don;t think I would trust them for actual cutting anyway.  I was more thinking of a tool change reference point that would not change every time the machine was turned on.  I may still be slightly confused on the sequence of things, need to work with it a little more...

Thanks for the input,
Dustin

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #6 on: November 16, 2009, 04:50:21 PM »
Hi Peter, Hood,
Hood, the CLICK I have is hooked up with a serial cable.  It is the DB 9 pin at the computer and a phone cord at the PLC.

Thank you,
Dustin

No need to use a Brain then if you use the old style serial interface, never used the serial plugin so dont know whether a brain is needed for it.


Heres a small part of my M6 macro

If GetSelectedTool=1  Then               'If selected tool = 1
 Do                                       'Start loop
 Call SetModOutput (9,1)                  'Toolchange signal to PLC to start turret indexing
 If GetInput (0) Then Exit Do             'Correct tool in position signal from PLC and exit loop
 Loop                                     'Continue loop if above signal is not present
 End If
 Call SetModOutput (9,0)                  'Cancel tool change signal to PLC
 
 If GetSelectedTool=2 Then                'If selected tool = 2
 Do
 Call SetModOutput (9,1)
 If GetInput (1)  Then Exit Do
 Loop
 End If
 Call SetModOutput (9,0)



Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #7 on: November 16, 2009, 04:55:49 PM »
The reason you want accurate homing is that you can set all your tools up in your turret and when you call them to go to a dia you know they will go exactly to that dia. Some people have said home switches are a waste of time on a lathe and that the tool will never cut at the same dia unless you take a test cut first and set them each time you start. I suspect they have lightweight machines that are not very rigid, your lathe is like mine, built like a brick s**t house and rigidity is not a problem ;)

Hood
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #8 on: November 16, 2009, 04:56:05 PM »
Thanks for the snippet Hood, I've found that on other posts and it is helpful.  Is SetModOutput a subroutine?  Or is that a command?  Where would I find info on the syntax of that (what the (9,1) means, etc)?  I am assuming it is toggling bit "9" in the PLC but I am fuzzy on how to address the PLC.

Dustin

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #9 on: November 16, 2009, 05:02:49 PM »
You dont actually need the Call part now (just found that out a few weeks ago from Ray)
The SetModOutPut(9,1) will set mod Output 9 active, SetModOutPut(9,0) will turn it off again.
GetInput(0)  is looking for the mod input 0

I will attach a screenshot, in a few mins, of the part of my ladder that the VB above is for.

Hood