U of U CS 5780 - LAB 9 - Stepper Motors

Unformatted text preview:

CS/ECE 5780/6780 Handout #9Spring 2007MyersLAB #9: Stepper MotorsLab writeup is due to your TA at the beginning of your next scheduled lab. Don’t put this off tothe last minute! There is pre-lab work to complete before the start of the next lab. NO LATELAB REPORTS WILL BE ACCEPTED.1 Objectives• Gain experie nce with stepper motor control.• Demonstrate a practical application of the 6812 timer system.2 Reading• Read Chapter 8 on stepper motors.3 BackgroundIn this lab, you will be designing an interface to a stepper motor. The stepper motor kit is availablein the lab for checkout, but you should not need to check it out until you are ready to demonstrateyour program. To control the stepper motor, you will be generating a pulse-width modulatedoutput using output compare 7 (OC7), and commands will be input from your keypad. Therefore,you likely will want to start with your Lab 7 code.Your program should support six commands.1. 1*nnnnn# - set period for step or half-steps2. 2*nnnnn# - set number of steps3. 3* - forward or clockwise mode4. 4* - backward or counter-clockwise mode5. 5* - full-step iterations6. 6* - half-step iterationsWe will be using OC7 because you can tie OC7 to other port T pins (PT7 through PT3) usingthe OC7M control register. You will control the stepper motor using PT7 through PT4. To controlthe stepper motor, you should output the following patterns in sequence to create half-steps:• %1010• %1000• %1001• %0001• %0101• %0100• %0110• %0010To move forward in half-steps, you will cycle through these patterns in the order shown. To movebackward, you will cycle through these patterns in the reverse order. To move in full-steps, you willoutput every other pattern. PT3 should simply alternate from 0 to 1 to behave like a “heartbeat”to show your device is working.4 Prelab1. Write C code for your main program which reads the keyboard command and updates anyglobal variables as necessary.2. Write C code for your output compare interrupt handler. Here is pseudocode for this handler:TC7 += step_periodif (step_count == 0)OC7D = 0elsechoose next step pattern index i (for half or full, fwd or backward)update OC7D with next patternstep_count--5 Lab Tasks1. Add L EDs with resi stors to pins PT7 through PT3.2. Test each of the six commands, and verify that your code produces the patterns expected onthe LEDs.3. Capture the patterns that you see on the oscilloscope and include these plots in your writeup.4. After you demonstrate your stepper motor controller to your TA, check out a stepper motorkit and D25 connector cable. Plug the D25 connector into the stepper motor kit and connectpins 2-5 to PT7, 6, 5, 4 (respectively) of your 6812 circuit. You can leave the LEDs in placeto verify operation. Connect one of the D25 ground pins (11, 12, or 25) to the ground railof your circuit. Hook up 12V across the +12V and GND terminals of the stepper motor kit.Specify a long period (65536) and verify that the 12V (24 step) motor steps appropriatelyeach time a new pattern is driven on PT4-7.5. Demonstrate all six commands. Demonstrate clockwise and counterclockwise rotations ofprecisely 90 degrees. Experiment with the motor control in order to answer the writeupquestions.6. Remove the 12V power and connect pins 6-9 of the D25 connector to PT7,6,5,4 of your 6812circuit. Supply 9V across the +9V and GND terminals of the stepper motor kit. Specify along period (65536) and verify that the 9V (400 step) motor steps appropriately each time anew pattern is driven on PT4-7. (It may be difficult to see the individual steps.)7. Demonstrate the six commands. Demonstrate clockwise and counterclockwise rotations ofprecisely 90 degrees. Experiment with the motor control in order to answer the writeupquestions. With the motor turning at its fastest speed, try to stop the motor by hand.8. Modify your circuit in order to drive the motor with a constant pattern %1000. Try to turnthe motor by hand.6 Writeup1. Include a printout of your final program and your HP Benchlink capture file.2. Describe any problems you encountered.3. Answer the following questions.(a) What is the fastest update frequency each of the motors could support without droppingsteps?(b) How does the motor behave when driven faster than it can handle?(c) Can the motors support faster halfstep update rates than full-step rates? If so, whywould this be the case?(d) When driving the motors at their highest speeds, do you notice any effects of inertiawhen switching the direction of rotation?(e) What is the effect of reversing the order of the stepper motor control pins (i.e., swappingPT7 with PT4, and PT6 with PT5)? You can answer this by experiment, or by analyzingthe stepper patterns.(f) Is it harder to stop the 9V stepper motor when it’s turning, or to turn it when it’sholding its position? Suggest a reason why this would be the


View Full Document

U of U CS 5780 - LAB 9 - Stepper Motors

Documents in this Course
Lab 1

Lab 1

5 pages

FIFOs

FIFOs

10 pages

FIFOs

FIFOs

5 pages

FIFO’s

FIFO’s

12 pages

MCU Ports

MCU Ports

12 pages

Serial IO

Serial IO

26 pages

Load more
Download LAB 9 - Stepper Motors
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LAB 9 - Stepper Motors and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LAB 9 - Stepper Motors 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?