U of U CS 5780 - LAB
 9 - 
Stepper
 Motors


Unformatted text preview:

CS/ECE%5780/6780%% % % % % % % % % Lab%#9%Spring%2010%Davis,%Atcitty,%Lee%LAB$#9:$Stepper$Motors$$The%Lab%write‐up%is%due%to%your%T A%at%t he%beginnin g%of%your%next%scheduled%lab.%Don’t%put%this% off%to%the%last%minute!%There%is%pre‐lab%work%to %complete%before%the%start%of%the%next %lab.%NO$LA TE$LAB$REPORTS%WILL$BE$ ACCEPTED.%$1$$$Objectives$•%Gain%experience%with%stepper%motor%control.%%•%Demonstrate%a%practical%application%of%the%6812%timer%sys tem.%%2$$$Reading$•%Read%Section%8.6%on%stepper%mot ors.%%3$$$Background$In%this%lab,%you%wi ll%b e%designing%an%interface%to %a%steppe r%motor.%The%stepper%motor%kit%is%available%in%the%lab%for%checkout,%but%y ou%should%not%need%to%check%it%out%until%you%are%ready%to%demonstrate%your%program.%The%stepper%motor%kit%can %not%leave%the%l ab.%%To%control%the%stepper%motor,%y ou%will%need%to%generate%the%co rrector %output%at%the%specified%period%as%specified% by% commands% input% from% your% keypad.% To% do% this,% it% is% suggested % that% you% use%output %compare%7%(OC7)%although%y ou%may %use%any%method%you%l ike.%Your%prog ram%supports%six%com mands.%Note%that%‘n’%is%an y%digit%0‐9.%%1. 1*nnnnn#%‐%set%the%period%in%us%for%full%steps%or%half‐step s.%2. 2*nnnnn#% ‐%set%number%of%steps % to%complete%before%st opping.%0%steps%indicates%that%the%motor%should%ru n%continuously.%3. 3*%‐%forwa rd%or%cl ockwise%mode.%4. 4*%‐%ba ckward%or% counter‐clockwise%mode. %5. 5*%‐%full‐step%iterations.%6. 6*%‐%ha lf‐step%iterations.%%For% example,% to% set% the% period % to% 100% us% I% would% ente r% ‘1*100#’.% You% can% selec t%reasonable%defaults%fo r%the%mode%of%operat ion. %The %defaults%should% be%clear ly%specified%as%a%comment%in%your%code.%If%you%are%using%OC7,%you %can%t ie%OC7%to%other%port%T%pins%(PT 7%though%PT3)%using%the%OC7M%cont rol%register.%All%solutions%will%contro l%the%stepper%motor%using%PT7 %through%PT4.%To%control%the%stepper%motor,%you%should%output%the %fo llowing%patterns%in%sequence%to%create%half‐steps.% •%%1010%%•%%1000%%•%%1001%%•%%0001%%•%%0101%%•%%0100%%•%%0110%%•%%0010%%To%move%forward%in%half‐ste ps,%you%will%cycle%t hrough %the se%patterns%in%the%order%shown .%To %mo ve%backward,%you% will %cyc le%through% these%patterns%in%the% reverse%order. %To%move%i n%full‐steps,%you%will%output%ever y%ot her%pattern.%PT3%or%the%LCD%should%be%used %to%produce%a%“he artbeat ”%to%show%your%device%is%working.%The%“heartbe at”%is%a%periodi cally%changing%signal%which%could%be%as%simp le%as%blink ing%an%LED.% 4$$$PreJlab$1. Write%C%code.%If%you%choose%to%use%OC7% the% pseudo code%fo r%this%handler%is%below:%%TC7%+=%step_period%if%(step_co unt%==%0)%OC7D%=%0%else%choose%next%step%pattern %ind ex%i%(for%ha lf%or%full,%fwd%or%backward)%update%OC 7D%with%next%p attern%step_count‐‐% 5$$$Ta sks$1. Add%LEDs%with%resist ors%to%pins%PT7%through%PT4%and%PT3%if% you %are%usi ng%it%for%the%“heartbeat”%signal.%2. Test%each%of%the%six%comman ds,%and%ver ify%that%your%code% produces%the%patterns%expected%on%the%LEDs.%3. Capture%the%patterns%that%you%see%o n%the%oscilloscope%and%include%th ese%plots%in%your%writeu p.%4. Aft er%you%demonstrate%your%stepper%motor%controller%to%your%TA,%check%out%a%steppe r%motor%kit%and%a%DB25%connector.%P lug%the% DB25%conn ector%into%the%stepper %motor%kit%and%connect%pins%2‐5%to%PT7,%6,%5,%4%(respectively)%of%yo ur%6812%circuit.%You%can%leave%the%LEDs%in%place%t o%verify%operation .%Conne ct%one%of%the%DB25%ground%pins%(11,%12,%or%25)%to%the%ground%rail%o f%yo ur%circuit.%Hoo k%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) %mo tor%steps%appropriately%each% time%a%new %pat tern%is%driven%on%PT4‐7.%5. Demonstrate%all%six%commands%to%your%TA. %Demonstrate%cloc kwi se%and%counterclockwise%rotations%of%p recisely%90%degrees.%Experiment %wit h%the%motor%contro l%in%order%to%answer%the%writeup%questions. %6. Remove%the%12V%power%and%connect%pins%6‐9%of%the%DB25%conne ctor%to%PT7,6,5,4%of%your%6812%circuit.%Supply%9V%across %the %+9V%and%GND%terminals%of%the%stepper%motor%kit.%Specify%a%long %period%and%verify%that%the%9V%(400%s tep)%motor %steps%appropriately %each%time%a%new%pattern%is%drive n%on%PT4‐7.%(It%may%b e%difficult%to%see%the%individual%steps.)%7. Demonstrate%the%six%commands%to%your%TA.%Demo nstrate%clockwise% and %counterclockwise%rotations%of%precisely%90%degrees.%Experiment %wit h%the%motor%contro l%in%order%to%answer%the%writeup%questions.%With%the%motor%turning%a t%its %fastest %speed,%try% to%stop%the%motor%by%hand.%8. Modify%your%c ircuit%in%order%to%drive%the%motor%with%a %constant%pattern%%1000.%Tr y%to%turn%the%motor %by%hand.%%6$$$Writeup$%1. Inc lude%a%printout%of%you r%final%program%and%your%cap ture%file.%2. Describe%any%problems%you%encountered.%3. Answer%the%following%qu estions.%(a) What%is%the%fastest%update%frequency%each%of%the%mo tors%could%support%without%dropping%steps?%(b) How%does%the%mot or%behave%when%driven%faste r%than%it%can%handl e?%(c) Ca n%the%motors%support%faster%half‐step%update%rates%tha n%full‐s tep% rates?%If%so,%wh y%would%this%be%the%case?%(d) When%driving%the%motors%at%their%highest %speeds,%do%yo u%notice%an y%effect s%of%ine rtia%when%switching%the%d irection%of% rotation?%(e) What%is%the%effect%of%reversing %the %order%of%the%stepper%mot or%control%pins%(i.e.,%swapping%PT7%with%P T4,% and %PT6%with%PT5)?%You%can%answer%this%by%experiment,%o r%by%analyz ing%the%stepper%patterns.%(f) Is%it%ha rder%to%stop%th e%9V%stepper%motor%w hen %it’s%turning,%or%to%turn%it%whe n%it’s%holding%its%position?%Suggest%a%reason%why%this%would


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?