Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: CJEls on August 12, 2008, 03:30:46 PM
-
Hi All
I have a weird problem with mach turn.When I call a tool the turret does not turn bur then I open vb editor and run the m6 script and then the turret will turn to the tool I called. I did en able tool Auto change in the general setup page .Any takers on this one.
Cj
-
Have seen that before with VB, it will run fine stepping through in the editor but wont run from Mach.
Has your toolchange ever worked in Mach?
Hood
-
Hi Hood
Yes it work with the hard drive that failed.
CJ
-
can you attach the macro and maybe someone will find a problem.
Hood
-
Hood
This is the code I hope some body can help.
Old_tool = GetCurrentTool()
New_Tool = GetSelectedTool()
If GetSelectedTool <1 Then 'If tool called is less than 1
MsgBox("Tool Out Of Range") 'show message
End 'End macro
End If
If GetSelectedTool >8 Then 'If selected tool is greater than 12
MsgBox("Tool Out Of Range") 'Show message
End 'End macro
End If
If GetselectedTool = GetCurrentTool Then 'If selected tool is the same as current tool then end macro
End
End If
If GetSelectedTool=1 Then 'If selected tool = 1
Do 'Start loop
Call ActivateSignal(output4) 'start turret indexing
If IsActive(Input1) And Not IsActive(Input2) And Not IsActive(Input3) And Not IsActive(Input4) 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 DeActivateSignal(OutPut4) 'Stops turret Indexing
If GetSelectedTool=2 Then
Do
Call ActivateSignal(output4)
If IsActive(Input1) And IsActive(Input2) And Not IsActive(Input3) And Not IsActive(Input4) Then Exit Do
Loop
End If
Call DeActivateSignal(OutPut4)
If GetSelectedTool=3 Then
Do
Call ActivateSignal(output4)
If Not IsActive(Input1) And IsActive(Input2) And Not IsActive(Input3) And Not IsActive(Input4) Then Exit Do
Loop
End If
Call DeActivateSignal(OutPut4)
If GetSelectedTool=4 Then
Do
Call ActivateSignal(output4)
If Not IsActive(Input1) And IsActive(Input2) And IsActive(Input3) And Not IsActive(Input4) Then Exit Do
Loop
End If
Call DeActivateSignal(OutPut4)
If GetSelectedTool=5 Then
Do
Call ActivateSignal(output4)
If Not IsActive(Input1) And Not IsActive(Input2) And IsActive(Input3) And Not IsActive(Input4) Then Exit Do
Loop
End If
Call DeActivateSignal(OutPut4)
If GetSelectedTool=6 Then
Do
Call ActivateSignal(output4)
If Not IsActive(Input1) And Not IsActive(Input2) And IsActive(Input3) And IsActive(Input4) Then Exit Do
Loop
End If
Call DeActivateSignal(OutPut4)
If GetSelectedTool=7 Then
Do
Call ActivateSignal(output4)
If Not IsActive(Input1) And Not IsActive(Input2) And Not IsActive(Input3) And IsActive(Input4) Then Exit Do
Loop
End If
Call DeActivateSignal(OutPut4)
If GetSelectedTool=8 Then
Do
Call ActivateSignal(output4)
If IsActive(Input1) And Not IsActive(Input2) And Not IsActive(Input3) And IsActive(Input4) Then Exit Do
Loop
End If
Call DeActivateSignal(OutPut4)
CJ
-
Hi
It seems that Mach is not seeing the m6 command.
Cj
-
Ha ha I recognise that code ;)
Ok I have half tested it here and it seems to be working in as much as its switching OutPut 4 on (seen on Diags screen)
Are you getting that?
If not then can you attach your xml to the thread.
Hood
-
Hi Hood
The turret turnsd to the correct posistion when iI run the code in Vb.The output4 does work.
CJ
-
Please attach your xml.
Hood
-
Hi Hood
got it sorted and it is working like a charm now it is the modbus that I must sort out.I can talk to the board if I run Xp cominications.I can set the port .baudrate but with mach it does not want to talk.
CJ
-
Hi hood
At Last all the problems solved.Now I can carry on and finish this toy lathe.Thank you for all the help it helps to talk to some one it gives you brain time to switch off and reset.
CJ
-
:)
-
Hallo Hood
The only probleme I have is that I can get the old style mod bus working with cnc4pc board.The new style where you enable the plugin does not work.But if you check that the board is working In modbus test you can see all the inputs and outputs, when writing a brain to say cycle start with modbus the input wil be modbus input 0 on port1. It will not work.You can see that the modbus test bit is coming on when you press the button but thats it.Am I missing some thing in the setup of the modbus.
CJ
-
Afraid I know nothing about these boards, hopefully Scott S will see this and reply as he uses them all the time.
Hood