Hello Guest it is January 21, 2020, 12:56:54 PM

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

0 Members and 1 Guest are viewing this topic.

M03 macro and changing pulleys
« on: March 01, 2011, 12:30:46 PM »
I'm having a problem getting my M3 macro to change pulleys for me. My machine has a high gear and low gear that is changed by outputs.

I have tried the "SetOemDRO(56,1)" to change the pulley and "SetPulley(1)", neither seem to work. When I issue an M3 and I check the "Settings" tab and I see that "Spindle Pulley" does not change. I also get the error "Too Fast for Pulley..Using Max.".

I have my pulleys set up like this:

Pulley 1 = 0min. 910 max.
Pulley 2 = 911min. 5000max.


This is what I have, maybe someone can tell me where I'm going wrong.


Spin = GetRPM()

If Spin < 911 Then
   SetOemDRO(56,1)
   Call LowGear
   End If
   

If Spin > 910 Then
   SetOemDRO(56,2)
   Call HighGear
   End If
   

Sub LowGear
   ActivateSignal(OUTPUT8)'Low Gear (OUTPUT)
   Sleep (50)
   
   Do Until IsActive(OEMTRIG2)'Low Gear Switch (INPUT)
   Loop
   
   If IsActive(OEMTRIG2) Then
   Call SpinSpindle
   End If
End Sub

Sub HighGear
   ActivateSignal(OUTPUT7)'High Gear (OUTPUT)
   Sleep (50)
   
   Do Until IsActive(OEMTRIG1)'High Gear Switch (INPUT)
   Loop
   
   If IsActive(OEMTRIG1) Then
   Call SpinSpindle
   End If
End Sub


Sub SpinSpindle

   DoSpinCW()

End Sub

Exit Sub


Any help would be great


Thanks,

Aero

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: M03 macro and changing pulleys
« Reply #1 on: March 01, 2011, 01:44:06 PM »
Try with
If GetRPM<911

Hood
Re: M03 macro and changing pulleys
« Reply #2 on: March 01, 2011, 02:01:37 PM »
Try with
If GetRPM<911

Hood

Still not getting the pulley to change. Is there a setting some where that needs to be set for auto pulley select?

Thanks,

Aero

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: M03 macro and changing pulleys
« Reply #3 on: March 01, 2011, 02:15:30 PM »
Not that I know of and seems to work here when I try to set the pulley, didnt have the rest of your VB though.
Try putting the pulley change in the spindlespeed.m1s


If you want to attach your xml I will try with that and see if I can find where its going wrong
Hood

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: M03 macro and changing pulleys
« Reply #4 on: March 01, 2011, 02:26:26 PM »
Just tried here with your code in the M3 and its fine so must be something in your xml.
Hood
Re: M03 macro and changing pulleys
« Reply #5 on: March 01, 2011, 02:28:58 PM »
OK, so I used M999 to test something. I put this in M999:

SetOemDRO(56,1)

I saved it then ran it in MDI. It changed my "Spindle Pulley" under the "Settings" tab to 1.  So I changed M999 to this:

SetOemDRO(56,2)

I saved it then ran it in MDI and it changed the "Spindle Pulley" under the "Settings" tab to 2. I can't see why it works fine with the M999 but not in my M3.

In my spindlespeed.m1s I only have this:

rpm = GetRPM() SetSpinSpeed( rpm )


I attached my .xml file.

Thanks for the help :)


Aero

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: M03 macro and changing pulleys
« Reply #6 on: March 01, 2011, 02:35:27 PM »
Ok working fine here with your xml.
One thing is I think the spindlespeed macros should be on two lines, ie
rpm = GetRPM()
SetSpinSpeed( rpm )

but not sure how that would make a difference, definitely worth trying though.

Hood
Re: M03 macro and changing pulleys
« Reply #7 on: March 01, 2011, 04:09:19 PM »
Ok working fine here with your xml.
One thing is I think the spindlespeed macros should be on two lines, ie
rpm = GetRPM()
SetSpinSpeed( rpm )

but not sure how that would make a difference, definitely worth trying though.

Hood

I tired that, no change. This is really strange. Is there anyway to link to a different Mcode from a VB script?


Thanks,

Aero

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: M03 macro and changing pulleys
« Reply #8 on: March 01, 2011, 04:16:14 PM »
I am crap at VB so not the best to advise on that but I think you have to be careful calling another macro from a macro.
Have you definitely got the macro named correctly, ie m3.m1s and placed in the correct folder?
I suppose if your output switches you must but not sure if you said whether it does or not?

Hood
Re: M03 macro and changing pulleys
« Reply #9 on: March 01, 2011, 04:31:40 PM »
Yes, if I manually change the pulley I can see that the relays for the gear change are working. It's just this darn SetOemDRO thing thats holding me back :(


Aero