Hello Guest it is April 16, 2024, 07:43:30 AM

Author Topic: M03 macro and changing pulleys  (Read 20145 times)

0 Members and 1 Guest are viewing this topic.

Re: M03 macro and changing pulleys
« Reply #20 on: March 02, 2011, 09:28:18 PM »
We have decided to drop the Galil and go with a DSPMC from Vital Systems. I'm hoping this will take care of a few things.


Thanks,

Aero
Re: M03 macro and changing pulleys
« Reply #21 on: April 11, 2011, 06:02:14 PM »
OK, I have got the new DSPMC from Vital Systems hooked up and running. BUT I'm still running into the same problem that I had with the Galil.

Here is a copy of my M03 macro:

SpinCW = GetRPM()

Message "S-Word = " & GetRPM()

'high gear input OEM#1, output#7
'low gear input OEM#2, output#8
'DeActivateSignal(OUTPUT2)'Spin Reverse
'ActivateSignal(OUTPUT1)'Spin Forward

 If SpinCW < 901 Then
   Call LowGear
   SetPulley(1)
   End If

 If SpinCW > 900 Then
   Call HighGear
   SetPulley(2)
   End If


 Sub LowGear
 
   DeActivateSignal(OUTPUT7)'HG=7 LG=8

   ActivateSignal(OUTPUT8)'Low Gear

   While IsActive(OEMTRIG2) = False'HG=1 LG=2
      Sleep 10
   Wend
   
   Sleep 100
   
   If IsActive(OEMTRIG2) Then
   Message "Low gear input is active"
   End If
   
   Call SpinSpindle
   
 End Sub
 
 
 
 Sub HighGear
 
   DeActivateSignal(OUTPUT8)'HG=7 LG=8

   ActivateSignal(OUTPUT7)'Low Gear

   While IsActive(OEMTRIG1) = False'HG=1 LG=2
      Sleep 10
   Wend

   Sleep 100
   
   If IsActive(OEMTRIG1) Then
        Message "High gear input is active"
        End If

   Call SpinSpindle
      
 End Sub

 Sub SpinSpindle

   'DoSpinCW()

 End Sub
 
Exit Sub

I'm just trying to test the gear changer without running the spindle, note the noted out 'DoSpinCW(). I can step through the macro just fine, I get all the messages and the wends work perfect. As soon as I try to run it through MDI, aka M3S100, I don't see the message from "Message "S-Word = " & GetRPM()". It still seems like it is running so fast through the program that it isn't reading it correctly. Even the Sleep 100's are not working in MDI, but work fine when stepping through it.

Any help would be great!!

Thanks,

Aero

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: M03 macro and changing pulleys
« Reply #22 on: April 11, 2011, 08:00:24 PM »
Some systems run the VB so fast it skips over commands.

For testing I would place a

While Ismoving()
Sleep(2000)
Wend


 between each command and see if it slows it down enough. If it does then start reducing the number a little at a time untill you find the magic delay time to make it all work.

If it all works fine while stepping throught the code then it is just timing issues. You have to regulate the process speed with hold states to keep mach from missing commands.

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: M03 macro and changing pulleys
« Reply #23 on: April 11, 2011, 08:03:28 PM »
Some systems run the VB so fast it skips over commands.

For testing I would place a

While Ismoving()
Sleep(2000)
Wend


 between each command and see if it slows it down enough. If it does then start reducing the number a little at a time untill you find the magic delay time to make it all work.

If it all works fine while stepping throught the code then it is just timing issues. You have to regulate the process speed with hold states to keep mach from missing commands.

I find the IF then goto sub#  works much better and is more dependable as it tends to stay in order sync. BUT that is just my opinion.

(;-) TP


Re: M03 macro and changing pulleys
« Reply #24 on: April 12, 2011, 11:24:56 AM »
I will increase my sleeps to see if I can slow it down a bit. I was think that maybe when an M03 is commanded that it reads some other file first for the pulley settings. It seems like it is seeing that the pulley isn't set to the right number before it runs the macro. Anyone have any thought on this?

Thanks,

Aero

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: M03 macro and changing pulleys
« Reply #25 on: April 13, 2011, 10:56:10 AM »
don't just add more sleep add the other statements as well. 

(;-) TP
Re: M03 macro and changing pulleys
« Reply #26 on: April 13, 2011, 11:51:07 AM »
OK, I GOT IT WOOOT!!!!

SpindleSpeed macro:

If GetRPM() <901 Then
SetPulley(1)
End If

If GetRPM() > 900 Then
SetPulley(2)
End If

rpm = GetRPM() SetSpinSpeed( rpm )


Works like a charm!!! And BR549 thanks for the suggestion on increasing the sleeps, now I can see everything working, and my messages are coming up like they should. Now I just need to test it with the spindle enabled and I'm off to make sure my tool changer still works properly!!!

P.S. Should I set all my gear changing in the SpinSpeed macro, so I can declutter my M3 macro?

Thanks,

Aero

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: M03 macro and changing pulleys
« Reply #27 on: April 13, 2011, 12:11:56 PM »
Good Job Areo,   Just do whatever works well for you.  I have learned over the years that each application can be different as to the computer used.

(;-) TP
Re: M03 macro and changing pulleys
« Reply #28 on: April 13, 2011, 02:03:04 PM »
OK, I got Mach to change the gear AND the pulley automatically. And I got it to pause before turning the spindle on, to allow time for the gear change to take effect (AKA no grinding gears... BIG plus :P). NOW for some reason, it is running the VFD at full speed in low and high... no matter what RPM I put in M03S?. It does changes the gears at the proper commanded speed.

 I have my pulley 1 set at 0-900 and pulley 2 set at 901-5000. I haven't set the ratio yet and that might be what the problem is...it did work before though. Why would Mach send a full 10v to my VFD?

Thanks,

Aero

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: M03 macro and changing pulleys
« Reply #29 on: April 13, 2011, 04:04:54 PM »
The ratio setting may not be what you think it is. It is a divisor for the pulse input to correct the rpm reading for use with a gearbox were the signal is dirived from the gearbox input (Bridgeport style).

(;-) TP