Im totally new! Please help! Tool changer PLC

Since the CNC controller you're using can't handle the tool changer, are you sure it will turn on and off the signals for the tool request?

Yes, I have it kinda working with the controller now with feeding the inputs to the controller, but the controller only sees the inputs 1/10th a second, too slow, and that's why I am missing tool changes. There is no way to slow this down... :(
 
After viewing a video, I'm concerned about speed. How fast will the turret spin? More important, how long will the four signals from the turret to the PLC representing the tool holder position be maintained.

For example when the turret is at position 1, how long will the signal on pin 1 be on? When the turret is at position 2, how long will the signals at pins 1 and 2 be on? When the turret is between positions 1 and 2, how long will all four signals be off?

The Click PLC may not be fast enough for this application.

In addition, have you verified that the CNC control that you're actually using sends those signals? My concern is your statement that the CNC controller "can't handle the tool changer". To me that implies the tool changer is an optional feature of the controller. It seems to me that the turret position request signals are an integral part of the tool changer option. So, without the tool changer option, does the controller really send a turret position request? I have to admit I know nothing about the details of the CNC controllers for Hardinge lathes and the options that may be available.

Edit: You replied while I was composing this response.
 
So, I can speed up or slow the turret down with a valve, easily done.

The controller is mach 3 and yes I can program the tool change macro, like a sub command, to send the requested tool change to the plc and wait for the plc to output to a pin which will tell mach 3 the controller that the tool change is complete.

The tool change inputs from tool changwr ill stay active anywhere from 1/10 second to 1/2 second
 
I totally agree, im just having an issue with the VB script, I could probably get it to work with just the cnc controller, do you have any knowledge of Visual Basic?

Thanks

Mike
 
Here is the code that I have, it works fine but it will not wait after it senses the right input, I put ****** by it...

I only added the ****** for the first two cases, but not the rest, its the same thing for the rest.

The first whileismoving() works fine but the second one does not work, it doesnt event wait... Any ideas?

'Macro ATC turret V2.02.01

Sub MovePos(ByVal ToolNumber As Integer)
OldTool = GetCurrentTool()
NewTool = GetSelectedTool()
ToolNumber = NewTool
If NewTool = OldTool Then
Message" Same Tool, NO ACTION"
End
End If
If NewTool > 8 Or NewTool < 1 Then
MsgBox" Tool # Not a Valid Number 1-8 ONLY, ENDING Program RUN "
DoButton(3)
End
End If
Tcount = 0
Select Case ToolNumber 'Position to each tool number by input signal
 
 
Case = 1
Message" Select Tool #1 "

ActivateSignal(Output5) 'Releases stop dog

While IsMoving()
Sleep 1000 ******************it will wait here fine...
Wend

ActivateSignal(Output6) 'Start Turret

Tcnt = 0
Do Until GetOemLed(821) = true And GetOemLed(822) = false And GetOemLed(823) = false And GetOemLed(824) = false Or Tcnt > 200000
Tcnt = (Tcnt+1)
Loop

If Tcnt >= 200000 Then
DoButton(3)
DeActivateSignal(Output5) 'Stopping turret
DeActivateSignal(Output6) 'Lowering and stopping air motor
MsgBox" Tool Turret Timed Out not receieving input signal from turret encoder"
End

Else

DeActivateSignal(Output5) 'Trigger Stop Dawg
Message"Triggering Stop Dawg"
While IsMoving()
Sleep 2000 **********************It does not wait here for some reason
Wend

DeActivateSignal(Output6) 'Lowering and stopping air motor
Message"Lowering and stopping air motor"

End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''

Tcnt2 = 0

Do Until isactive(29) ' Check for reseating of turret
Tcnt2 = (Tcnt2 +1)
If Tcnt2 > = 10000 Then
DoButton(3)
MsgBox(" Turret Timed Out and Did Not Reseat")
End
End If
Loop



message " Tool #1 Loaded"

''*****************************************************************
Case = 2
Message" Select Tool #2 "

ActivateSignal(Output5) 'Releases stop dog

While IsMoving()
Sleep 1000 *************waits ok
Wend

ActivateSignal(Output6) 'Start Turret

Tcnt = 0
Do Until GetOemLed(821) = false And GetOemLed(822) = true And GetOemLed(823) = false And GetOemLed(824) = false Or Tcnt > 200000
Tcnt = (Tcnt+1)
Loop

If Tcnt >= 200000 Then
DoButton(3)
DeActivateSignal(Output5) 'Stopping turret
DeActivateSignal(Output6) 'Lowering and stopping air motor
MsgBox" Tool Turret Timed Out not receieving input signal from turret encoder"
End

Else

DeActivateSignal(Output5) 'Trigger Stop Dawg
Message"Triggering Stop Dawg"
While IsMoving()
Sleep 2000 **********************it does not wait
Wend

DeActivateSignal(Output6) 'Lowering and stopping air motor
Message"Lowering and stopping air motor"
End If

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Tcnt2 = 0

Do Until isactive(29) ' Check for reseating of turret
Tcnt2 = (Tcnt2 +1)
If Tcnt2 > = 10000 Then
DoButton(3)
MsgBox(" Turret Timed Out and Did Not Reseat")
End
End If
Loop

message " Tool #2 Loaded"

''*****************************************************************
Case = 3
Message" Select Tool #3 "

ActivateSignal(Output5) 'Releases stop dog

While IsMoving()
Sleep 1000
Wend


ActivateSignal(Output6) 'Start Turret

Tcnt = 0
Do Until GetOemLed(821) = true And GetOemLed(822) = true And GetOemLed(823) = false And GetOemLed(824) = false Or Tcnt > 200000
Tcnt = (Tcnt+1)
Loop

If Tcnt >= 200000 Then
DoButton(3)
DeActivateSignal(Output5) 'Stopping turret
DeActivateSignal(Output6) 'Lowering and stopping air motor
MsgBox" Tool Turret Timed Out not receieving input signal from turret encoder"
End

Else

DeActivateSignal(Output5) 'Trigger Stop Dawg
Message"Triggering Stop Dawg"
While IsMoving()
Sleep 2000
Wend

DeActivateSignal(Output6) 'Lowering and stopping air motor
Message"Lowering and stopping air motor"
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Tcnt2 = 0

Do Until isactive(29) ' Check for reseating of turret
Tcnt2 = (Tcnt2 +1)
If Tcnt2 > = 10000 Then
DoButton(3)
MsgBox(" Turret Timed Out and Did Not Reseat")
End
End If
Loop
message " Tool #3 Loaded"

''*****************************************************************
 
Case = 4
Message" Select Tool #4 "

ActivateSignal(Output5) 'Releases stop dog

While IsMoving()
Sleep 1000
Wend


ActivateSignal(Output6) 'Start Turret

Tcnt = 0
Do Until GetOemLed(821) = false And GetOemLed(822) = false And GetOemLed(823) = true And GetOemLed(824) = false Or Tcnt > 200000
Tcnt = (Tcnt+1)
Loop

If Tcnt >= 200000 Then
DoButton(3)
DeActivateSignal(Output5) 'Stopping turret
DeActivateSignal(Output6) 'Lowering and stopping air motor
MsgBox" Tool Turret Timed Out not receieving input signal from turret encoder"
End

Else

DeActivateSignal(Output5) 'Trigger Stop Dawg
Message"Triggering Stop Dawg"
While IsMoving()
Sleep 2000
Wend

DeActivateSignal(Output6) 'Lowering and stopping air motor
Message"Lowering and stopping air motor"
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Tcnt2 = 0

Do Until isactive(29) ' Check for reseating of turret
Tcnt2 = (Tcnt2 +1)
If Tcnt2 > = 10000 Then
DoButton(3)
MsgBox(" Turret Timed Out and Did Not Reseat")
End
End If
Loop

Message " Tool #4 Loaded"

''*****************************************************************
Case = 5
Message" Select Tool #5 "


ActivateSignal(Output5) 'Releases stop dog

While IsMoving()
Sleep 1000
Wend

ActivateSignal(Output6) 'Start Turret

Tcnt = 0
Do Until GetOemLed(821) = true And GetOemLed(822) = false And GetOemLed(823) = true And GetOemLed(824) = false Or Tcnt > 200000
Tcnt = (Tcnt+1)
Loop

If Tcnt >= 200000 Then
DoButton(3)
DeActivateSignal(Output5) 'Stopping turret
DeActivateSignal(Output6) 'Lowering and stopping air motor
MsgBox" Tool Turret Timed Out not receieving input signal from turret encoder"
End

Else

DeActivateSignal(Output5) 'Trigger Stop Dawg
Message"Triggering Stop Dawg"
While IsMoving()
Sleep 2000
Wend

DeActivateSignal(Output6) 'Lowering and stopping air motor
Message"Lowering and stopping air motor"
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Tcnt2 = 0

Do Until isactive(29) ' Check for reseating of turret
Tcnt2 = (Tcnt2 +1)
If Tcnt2 > = 10000 Then
DoButton(3)
MsgBox(" Turret Timed Out and Did Not Reseat")
End
End If
Loop
message " Tool #5 Loaded"

''*****************************************************************
Case = 6
Message" Select Tool #6 "

ActivateSignal(Output5) 'Releases stop dog

While IsMoving()
Sleep 1000
Wend


ActivateSignal(Output6) 'Start Turret

Tcnt = 0
 
Do Until GetOemLed(821) = false And GetOemLed(822) = true And GetOemLed(823) = true And GetOemLed(824) = false Or Tcnt > 200000
Tcnt = (Tcnt+1)
Loop

If Tcnt >= 200000 Then
DoButton(3)
DeActivateSignal(Output5) 'Stopping turret
DeActivateSignal(Output6) 'Lowering and stopping air motor
MsgBox" Tool Turret Timed Out not receieving input signal from turret encoder"
End

Else

DeActivateSignal(Output5) 'Trigger Stop Dawg
Message"Triggering Stop Dawg"
While IsMoving()
Sleep 2000
Wend

DeActivateSignal(Output6) 'Lowering and stopping air motor
Message"Lowering and stopping air motor"
End If


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Tcnt2 = 0

Do Until isactive(29) ' Check for reseating of turret
Tcnt2 = (Tcnt2 +1)
If Tcnt2 > = 10000 Then
DoButton(3)
MsgBox(" Turret Timed Out and Did Not Reseat")
End
End If
Loop
message " Tool #6 Loaded"

''*****************************************************************
Case = 7
Message" Select Tool #7 "

ActivateSignal(Output5) 'Releases stop dog

While IsMoving()
Sleep 1000
Wend

ActivateSignal(Output6) 'Start Turret

Tcnt = 0
Do Until GetOemLed(821) = true And GetOemLed(822) = true And GetOemLed(823) = true And GetOemLed(824) = false Or Tcnt > 200000
Tcnt = (Tcnt+1)
Loop

If Tcnt >= 200000 Then
DoButton(3)
DeActivateSignal(Output5) 'Stopping turret
DeActivateSignal(Output6) 'Lowering and stopping air motor
MsgBox" Tool Turret Timed Out not receieving input signal from turret encoder"
End

Else

DeActivateSignal(Output5) 'Trigger Stop Dawg
Message"Triggering Stop Dawg"
While IsMoving()
Sleep 2000
Wend

DeActivateSignal(Output6) 'Lowering and stopping air motor
Message"Lowering and stopping air motor"
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Tcnt2 = 0

Do Until isactive(29) ' Check for reseating of turret
Tcnt2 = (Tcnt2 +1)
If Tcnt2 > = 10000 Then
DoButton(3)
MsgBox(" Turret Timed Out and Did Not Reseat")
End
End If
Loop
message " Tool #7 Loaded"

''*****************************************************************
Case = 8
Message" Select Tool #8 "

ActivateSignal(Output5) 'Releases stop dog

While IsMoving()
Sleep 1000
Wend

ActivateSignal(Output6) 'Start Turret

Tcnt = 0
Do Until GetOemLed(821) = false And GetOemLed(822) = false And GetOemLed(823) = false And GetOemLed(824) = true Or Tcnt > 200000
Tcnt = (Tcnt+1)
Loop

If Tcnt >= 200000 Then
DoButton(3)
DeActivateSignal(Output5) 'Stopping turret
DeActivateSignal(Output6) 'Lowering and stopping air motor
MsgBox" Tool Turret Timed Out not receieving input signal from turret encoder"
End

Else

DeActivateSignal(Output5) 'Trigger Stop Dawg
Message"Triggering Stop Dawg"
While IsMoving()
Sleep 2000
Wend

DeActivateSignal(Output6) 'Lowering and stopping air motor
Message"Lowering and stopping air motor"
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Tcnt2 = 0

Do Until isactive(29) ' Check for reseating of turret
Tcnt2 = (Tcnt2 +1)
If Tcnt2 > = 10000 Then
DoButton(3)
MsgBox(" Turret Timed Out and Did Not Reseat")
End
End If
Loop
message " Tool #8 Loaded"
''********************************************************************
End Select

SetOemDro(824,NewTool)
End Sub
End
 
I'm not sure why you have the Sleep instruction inside the While/WEND. In the first instance, presumably IsMoving() evaluates true so the Sleep 1000 instruction executes. In the second instance, presumably IsMoving() evaluates false so the Sleep 2000 instruction doesn't execute.
 
I'm not sure why you have the Sleep instruction inside the While/WEND. In the first instance, presumably IsMoving() evaluates true so the Sleep 1000 instruction executes. In the second instance, presumably IsMoving() evaluates false so the Sleep 2000 instruction doesn't execute.

Mmm, great point, how would I make the second sleep function true? Or is there another wait command that I can make that to wait after the output5 activates?

I so appreciate your help!
 
Does the CNC controller's scripting tool allow you to single-step through the code? Are you seeing the messages pop up that tell you what path the script is taking through the code? I've worked with VB scripts that have the "MsgBox" instruction and some that use the "Message" instruction, but never both. You're using both.
 

Similar Topics

personally I don't care about golf - but this is one impressive shot ... if it weren't on tape, I wouldn't have believed it ... the first video in...
Replies
1
Views
1,609
Hi Forum, so going by search this is a first thread re this subject, which is good but very sad in the same respect. I am NOT looking for any...
Replies
60
Views
19,229
Hi, Sorry if this is not the right place for this, but I thought as there will be a lot of engineers on here who may well have done what I am...
Replies
9
Views
3,426
Hey guys, I had a slc 5/03 communicating nicely via 232 connection with my proface HMI until I started playing with the program I had been...
Replies
10
Views
2,598
http://www.foxnews.com/leisure/2015/02/10/miniature-w-32-engine-is-mind-blowing/?intcmp=trending NOTE: play the video - and do NOT skip the final...
Replies
8
Views
5,426
Back
Top Bottom