1571
VB and the development of wizards / Re: Macro for Rotary Tool Changer
« on: December 09, 2018, 04:28:02 AM »
ok i think the Problem is that the Inputs are not updated synchron.
try this code:
try this code:
Code: [Select]
ToolRdy = false
While(Not ToolRdy)
If GetCsmioIn(BCD1) or GetCsmioIn(BCD2) or GetCsmioIn(BCD4) or GetCsmioIn(BCD8) then
'give the inputs a chance to update
Sleep(150)
'then read the BCD code
ActATCPos = 0
If GetCsmioIn(BCD1) Then
ActATCPos = ActATCPos + 1
End If
If GetCsmioIn(BCD2) Then
ActATCPos = ActATCPos + 2
End If
If GetCsmioIn(BCD4) Then
ActATCPos = ActATCPos + 4
End If
If GetCsmioIn(BCD8) Then
ActATCPos = ActATCPos + 8
End If
If (ActATCPos = (ToolSlot - 1)) Then
ToolRdy = true
End If
End If
Wend