Hello Guest it is November 20, 2019, 10:35:16 PM

Author Topic: Help controlling a stepper motor as a lowRPM spindle  (Read 17074 times)

0 Members and 1 Guest are viewing this topic.

Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #60 on: September 10, 2012, 01:54:45 PM »
Hi Hood,
Hoping you could help me with a little problem I am having with a bit of code I wrote. Up to now I have not bothered with the switching of Output #7 as I have only wired it in today. The code I did was to set the output #7, wait for input #1, reset output #7, then move 60 degrees at a feedrate of 10000, and call it Macro M211. When I have been running the program, it runs fine and waits for input #1. Now that I have the output #7 configured (port 2 pin 1) and wired, I don't see it turning on and off. If I go into my Ports and Pins Output config, I can set it by making it low active, so I know it is configured and wired OK.

My M211 Macro looks like this:

ActivateSignal (OUTPUT7)
SystemWaitFor (INPUT1)
DeactivateSignal (OUTPUT7)
Code "G91G1A60F10000"

My program code is:

M211
G4P2
M211
G4P2
M211
G4P2
M211
G4P2
M211
G4P2
M211
G4P2
M30

This rotates my fixture a total of 360 degrees (6 x 60 degrees)

Thanks, Barry.

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #61 on: September 10, 2012, 03:44:32 PM »
Try changing the active state of Input 1 and see if it makes a difference.
Hood
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #62 on: September 11, 2012, 12:57:38 PM »
No difference Hood. I separated the 4 lines of code to 4 Macros, put them in sequence in the program, and it works like a charm.

Barry.

Offline BR549

*
  •  6,916 6,916
    • View Profile
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #63 on: September 11, 2012, 01:16:33 PM »
May want to try it this way to see IF it makes a difference


ActivateSignal (OUTPUT7)
While Ismoving()
Wend
SystemWaitFor (INPUT1)
DeactivateSignal (OUTPUT7)
While Ismoving()
Wend
Code "G91G1A60F10000"
While Ismoving()
Wend

Just a thought, (;-) TP

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #64 on: September 11, 2012, 03:17:29 PM »
If Terrys way doesnt work here is how I would do it, I like my Do Loops ;)

If Not IsActive(Input1) Then
 Do                                       
 ActivateSignal(OutPut7)                 
 If IsActive(Input1) Then Exit Do 
 sleep 10         
 Loop
 DeActivateSignal(OutPut7)
 End If
 Code "G91G1A60F10000"

Hood
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #65 on: September 11, 2012, 03:23:58 PM »
Thanks Hood and Terry.
I am finishing work now (trying to catch the second half of the England/Ukraine game). I will try those codes tomorrow and let you know how I get on.

Barry.
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #66 on: September 12, 2012, 10:27:16 AM »
I tried both codes, and they both work great  ;D Thanks to both Hood and Terry.

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #67 on: September 12, 2012, 10:42:59 AM »
Ha ha well you now have a choice depending on the mood you are in  ;D
Hood
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #68 on: September 12, 2012, 10:54:41 AM »
As I have to repeat the code 5 times per cycle,  :-\ out of respect for both you guys my code will now look a little something like this:

M215 (Hood)
M216 (Terry)
M215 (Hood)
M216 (Terry)
M215 (Hood)
M47

Barry  ;D

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: Help controlling a stepper motor as a lowRPM spindle
« Reply #69 on: September 12, 2012, 03:03:45 PM »
;D

Hood