Date post: | 13-Feb-2018 |
Category: |
Documents |
Upload: | eric-rodriguez |
View: | 218 times |
Download: | 0 times |
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 1/23
1
Chapter 5: Measuring RotationChapter 5: Measuring Rotation
Presentation based on:
"What's a Microcontroller ?"By Andy LindsayParallax, Inc
Presentation developed by:Presentation developed by:
Martin A. ebelMartin A. ebel!othern Illinois #niversity $arbondale!othern Illinois #niversity $arbondale
$olle%e o& Applied !ciences and Arts$olle%e o& Applied !ciences and Arts
lectronic !yste(s )echnolo%ieslectronic !yste(s )echnolo%ies*++-
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 2/23
2
Presentation IndexPresentation Index
#se and $opyri%ht
Ad/stin% 0ials and Monitorin% #sin% a potentio(eter as a variable resistor
Activity 1: Bildin%+)estin% Potentio(eter $ircit
Activity 12: Measrin% #sin% )i(e
Introdcin% the $apacitor Polled 3$ )i(e
Activity 1: 3eadin% 4ith BA!I$ !ta(p
3$)IM Pro%ra( xplanation
Activity 15: !ervo $ontrol 4ith Potentio(eter
$hapter 15 3evie4
Lin6s
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 3/23
3
Use and CopyrightUse and Copyright
)his presentation spple(ents "What's aMicrocontroller" by Andy Lindsay. 7Lin6 to text at
Parallax8 )his presentation is not a replace(ent &or the text.
I(portant concepts o& the text are hi%hli%hted.
In so(e cases, additional (aterial has been added
to a%(ent the text. 0enoted by titles colored %old%old. 9ll pro%ra( listin%s are %enerally not provided in
the presentation.
Distribution:
)his presentation (ay be &reely distribted 4ithot(odications. Modications are per(itted byschools and or%ani;ations &or internal se only.$redits, se and copyri%ht slides (st re(ain.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 4/23
4
CP!RI#$% &D $R&D(M&R)%
)his doc(entation is $opyri%ht 2-- by Parallax, Inc. By do4nloadin% orobtainin% a printed copy o& this doc(entation or so&t4are yo a%ree that itis to be sed exclsively 4ith Parallax prodcts. Any other ses are notper(itted and (ay represent a violation o& Parallax copyri%hts, le%allypnishable accordin% to 9ederal copyri%ht or intellectal property la4s. Anydplication o& this doc(entation &or co((ercial ses is expressly prohibitedby Parallax, Inc. $hec6 4ith Parallax &or approval prior to dplicatin% any o&or doc(entation in part or 4hole &or any se.
BA!I$ !ta(p is a re%istered trade(ar6 o& Parallax, Inc. I& yo decide to se thena(e BA!I$ !ta(p on yor 4eb pa%e or in printed (aterial, yo (st statethat "BA!I$ !ta(p is a re%istered trade(ar6 o& Parallax, Inc." <ther brandand prodct na(es are trade(ar6s or re%istered trade(ar6s o& theirrespective holders.
DI%C*&IM(R + *I&,I*I$!
Parallax, Inc. and !othern Illinois #niversity are not responsible &or special,
incidental, or conse=ential da(a%es resltin% &ro( any breach o& 4arranty,or nder any le%al theory, incldin% lost prots, do4nti(e, %ood4ill, da(a%e
to or replace(ent o& e=ip(ent or property, or any costs o& recoverin%,repro%ra((in%, or reprodcin% any data stored in or sed 4ith Parallax
prodcts. Parallax is also not responsible &or any personal da(a%e, incldin%that to li&e and health, resltin% &ro( se o& any o& or prodcts. >o ta6e &ll
responsibility &or yor BA!I$ !ta(p application, no (atter ho4 liðreatenin% it (ay be.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 5/23
5
&d-usting Dials and Monitoring&d-usting Dials and Monitoring
0ials are ideal inpt devices &or
ad/st(ents sch as roo( li%htin%and vol(e levels.
)hey are also sed inside devices &or
&eedbac6, sch as inside the servo tosense actal position.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 6/23
6
Using a potentio.eter as a /ariableUsing a potentio.eter as a /ariable
resistorresistor )he device inside the dial is called a
variable resistor or potentio(eter. )hey are sed in dials, /oystic6s, and(any other devices 4hich need to
prodce an otpt in re&erence to aposition.
Potentio(eters can be pac6a%ed(any dierent 4ays.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 7/23
7
)he potentio(eter is a resistor 4ith
t4o ter(inals si(ilar to a re%larresistor, bt also has a 4iperter(inal to ad/st 4here contact is
(ade.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 8/23
8
)he distance &ro( the 4iper to each ter(inal
deter(ines the resistance &or that path. )he (ini(( resistance 4ill be - oh(s,and the (axi(( 4ill be the ratin% o& thepotentio(eter, sch as -@ .
Low resistance
High resistance
High resistance
Low resistance
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 9/23
9
&cti/ity 01: ,uilding2$esting Potentio.eter&cti/ity 01: ,uilding2$esting Potentio.eter
CircuitCircuit
$onstrct the circit and observe the
L0's bri%htness at dierent settin%so& the potentio(eter.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 10/23
10
When the L0 4as bri%htest, 4as the
potentio(eter resistance hi%hest orlo4est in the path to the L0?
When the L0 4as bri%htest, 4as thepotentio(eter 4iper closest or &rthest
&ro( ter(inal connected to dd?
7clic6 &or ans4ers8
Lowest
Closest
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 11/23
11
&cti/ity 03: Measuring Using $i.e&cti/ity 03: Measuring Using $i.e
In this activity an 3$net4or6
73esistor$apacitor8 is sed to &or( acircit. )he capacitor is char%ed anddischar%ed at dierent rates
deter(ined by the resistor and thecapacitor si;es.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 12/23
12
Introducing the CapacitorIntroducing the Capacitor
)he capacitor is a device 4hich can store an
electron char%e. Its si;e is expressedtypically in (icro&arads 7µ98 or (illionthso& 9arads.
$ertain types o& capacitors are polaritysensitive, that is, they can only beconnected in one direction.
$onnectin% a polarity sensitivecapacitor bac64ards can casethe device to explode.
CWear sa4ety glassesC(nsure proper polarity6hen connecting
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 13/23
13
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 14/23
14
Polled RC $i.ePolled RC $i.e
In the Polled 3$ )i(e circit the &ollo4in% occrs:
Btton is pressed char%in% the capacitor.
5V
)he btton is released, the BA!I$!ta(p
be%ins ti(in% and the capacitor be%ins todischar%e.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 15/23
15
. )he BA!I$ !ta(p contines ti(in% ntil
inpt PD chan%es to a lo4 7drops belo4.58.L<<P #E)IL IEDF-
5. )i(e is displayed in tenths o& seconds.
V => 1.4V
Logic 1
V < 1.4V
Logic 0
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 16/23
16
)he ti(e to dischar%e the capacitor is
in proportion to the si;e o& theresistor and capacitor net4or6 73$8.
)he lar%er the capacitance 7$8, the%reater the char%e it can hold,increasin% ti(e.
)he lar%er the resistance 738, theslo4er the capacitor 4ill dischar%e,increasin% ti(e.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 17/23
17
&cti/ity 07: Reading 6ith ,&%IC&cti/ity 07: Reading 6ith ,&%IC
%ta.p%ta.p )he BA!I$ !ta(p has an instrction to
per&or( (ch o& the ti(in% operationato(atically:
RC$IM( Pin, State, Variable
Where:
Pin is the pin the 3$ net4or6 is connected.
State is the initial state 4hen ti(in%be%ins.
Variable is the (e(ory location to storethe reslts. Gst li6e P#L!<#) the ti(e isthe n(ber o& 2! incre(ents.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 18/23
18
ReadPotWithRC$i.e Progra.ReadPotWithRC$i.e Progra.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 19/23
19
RC$IM( Progra. (xplanationRC$IM( Progra. (xplanation
0eclare variable ti(e to hold reslts.
0<L<<P code bloc6:C !et I+< PD IH 78.
C Wait -- (! to char%e capacitor and
stabili;e 0B#H screen.C xecte 3$)i(e instrction:
)i(e ntil capacitor dischar%es andPD leaves dened state 78.
!tore reslts in variable )i(e.
C 0isplay )i(e reslts.
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 20/23
20
%cope Capture%cope Capture
End of High,RCTime begins timing.
1.4V threshod crossed
!fter "m# $5m#%&i'(
"m# % )*# = co*nt of 4500
i i % C l i h& ti it 08 % C t l ith
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 21/23
21
&cti/ity 08: %er/o Control 6ith&cti/ity 08: %er/o Control 6ith
Potentio.eterPotentio.eterIn this activity the vale o& 3$)i(e is
sed to control a servo. )he 3$)i(e readin% is oset to be
4ithin the controllable ran%e o& the
servo 7-----8.A constant is sed to hold the oset
vale:
9set C 7Pin I+<'s are na(ed sin% $<E:
rcPI C ;
h i
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 22/23
22
Chapter 08 Re/ie6Chapter 08 Re/ie6
A potentio(eter is a variable resistor 4herethe 4iper is sed to ad/st the resistance.
$apacitors are sed to hold a char%e.
A resistor and capacitor are sed to &or( an3$ net4or6.
)he rate o& char%e or dischar%e is dependenton the vales o& 3 and $.
An inpt pin 4ill read hi%h 78 ntil volta%edrops belo4 .5.
Pollin% can be sed to (easre ho4 lon% itta6es the capacitor to reach .5.
3$)i(e (easres the dischar%e ti(e andstores the reslts in a variable as 2!incre(ents.
*i <
7/23/2019 wam_ch5
http://slidepdf.com/reader/full/wamch5 23/23
*in<s*in<s
BA!I$ !ta(p o(e
!ta(ps In $lass o(eBA!I$ !ta(p !o&t4are
BA!I$ !ta(p 3obots
BA!I$ !ta(p >ahoo Hrop
!ta(ps In $lass >ahoo Hrop
!I#$ !) 0e%ree