lecture unit1 mca
Post on 03-Mar-2018
222 Views
Preview:
TRANSCRIPT
-
7/26/2019 Lecture Unit1 Mca
1/99
Unit 1
Introduction to Microcontrollers
Prepared By,
ANILKUMAR PATIL M.Tech, (Ph.D).,
Asst Prof- E&TC
anilkumarpatil1988@mail.com
-
7/26/2019 Lecture Unit1 Mca
2/99
Introduction A decade back the process and control operations were totally
implemented by the Microprocessors only. But now a days the situation
is totally changed and it is occupied by the new devices called
Microcontroller. The development is so drastic that we cant find any
electronic gadget without the use of a microcontroller. This
microcontroller changed the embedded system design so simple and
advanced that the embedded market has become one of the most sought
after for not only entrepreneurs but for design engineers also.
!hat is a Microcontroller"
A single chip computer or A CP with all the peripherals like !AM"
!#M" $%# Ports" Timers " A&Cs etc... on the same chip. 'or e()
Motorolas *+,," $ntels +-," /ilogs /+ and P$C ,*0 etc1
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
3/99
MI#$%P$%#&''%$' MI#$%#%T$%**&$'
Microprocessor+ #PU -uilt into a sinle *'I chip is called a microprocessor. It is a eneral/purpose de0ice
and additional eternal circuitr2 are added to make it a microcomputer. The microprocessorcontains arithmetic and loic unit (*U), Instruction decoder and control unit, Instruction
reister, Proram counter (P#), clock circuit (internal or eternal), reset circuit (internal or
eternal) and reisters. 3ut the microprocessor has no on chip I4% Ports, Timers , Memor2 etc.
5or eample, Intel 8687 is an 8/-it microprocessor and Intel 86848688 a 1/-it microprocessor.
The -lock diaram o the Microprocessor is sho:n in 5i.1
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
4/99
MI#$%#%T$%**&$+
microcontroller is a hihl2 interated sinle chip, :hich consists o on chip #PU (#entralProcessin Unit), $M ($andom ccess Memor2), &P$%M4P$%M4$%M (&rasa-leProramma-le $ead %nl2 Memor2), I4% (input4output) ; serial and parallel, timers, interrupt
controller.
5or eample, Intel 8671 is 8/-it microcontroller and Intel 869 is 1/-it microcontroller. The-lock diaram o Microcontroller is sho:n in 5i.
-
7/26/2019 Lecture Unit1 Mca
5/99
Dierence -et:een MPU and M#U
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
6/99
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
7/99
on eumann rchitecture) $t has single memory storage to hold both program instructionsand data i.e. common program and data space. The CP can either read an instruction or data
from the memory one at a time 2or write data to memory3 because instructions and data areaccessed using same bus system. The 4on 5eumann Architecture is named after the mathematicianand computer scientist 6ohn 4on 5eumann. The basic organi7ation of memory in this architecture is
shown in figure ,.8. The advantage of 4on 5eumann architecture is simple design of microcontroller chip because only
one memory is to be implemented which in turn reduces re9uired hardware.
The disadvantage is slower e(ecution of a program. $t is also referred as Princeton architecture asit was developed at Princeton niversity. Motorola *+:C,, microcontroller is based on
4on5eumann architecture.
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
8/99
>ar0ard rchitecture+$t has physically separate memory storage to hold programinstructions and data i.e. separate program and data space. ;ince it has separatebuses to access program and data memory" it is possible to access program memoryand data memory simultaneously. The organi7ation of memory and buses in thisarchitecture is shown in figure ,.+.
The advantage of a :arvard architecture microcontroller is that it is faster for a givencircuit comple(ity because it offers greater amount of parallelism. The disadvantage isthat it re9uires more hardware" because two sets of buses and memory blocks arere9uired. MC; , 2+-, family3 and P$C microcontrollers are based on :arvardarchitecture
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
9/99
>ar:ard and on eumann architecture
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
10/99
$I'# and #I'# comparison
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
11/99
CISC RISC
Greater no. of Instructons !esser no. of nstructons
Genera""# no nstructon $$e"nn% feature Instructon P$e"nn% an& ncrease&e'ecuton s$ee&
(on )rt*o%ona" Instructon +et ,A""nstructons are not a""oe& to o$erate onan# re%ster an& use an# a&&ressn% o&e.It s nstructon s$ecfc
)rt*o%ona" Instructon +et ,A""os eac*nstructon to o$erate on an# re%ster an&use an# a&&ressn% o&e
)$eratons are $erfore& on re%sters oreor# &e$en&n% on t*e nstructon
)$eratons are $erfore& on re%sterson"# t*e on"# eor# o$eratons are "oa&an& store
!te& no. of %enera" $ur$ose re%sters !ar%e nuer of re%sters are a2a"a"e
Instructons are "3e acros n "an%ua%e. Pro%raer nee&s to rte ore co&e to
e'ecute a tas3 snce t*e nstructons ares$"er ones
5ara"e "en%t* Instructons +n%"e 'e& "en%t* Instructons
More s"con usa%e !ess +"con usa%e an& $n count
7ar2ar& or 5on-(euann Arc*tecture 8t* 7ar2ar& Arc*tecture
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
12/99
Disad0antaes o microprocessor
The o0erall s2stem cost is hih
lare si?ed P#3 is re=uired or
assem-lin all the components %0erall product desin re=uires more time
Ph2sical si?e o the product is -i
discrete components are used, thes2stem is not relia-le
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
13/99
d0antaes o Microcontroller
-ased '2stem s the peripherals are interated into a sinle chip, the o0erall
s2stem cost is 0er2 less
The product is o small si?e compared to micro processor -ased
s2stem The s2stem desin no: re=uires 0er2 little eorts
s the peripherals are interated :ith a microprocessor the
s2stem is more relia-le
Thouh microcontroller ma2 ha0e on chip $%M,$M and I4%
ports, addition $%M, $M I4% ports ma2 -e interaced
eternall2 i re=uired
%n chip $%M pro0ide a sot:are securit2
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
14/99
pplications o Microcontrollers 3iomedical instrumentations
*#D Displa2 cum recorder
3lood cell recorder cum nal2?er
Patient monitor s2stem
#ommunication '2stems
umeric Paer
cellular phones ca-le T terminals
5A
0ideo ames etc..
Peripheral controllers
ke2-oard controller D$M controller
printer controller
*'&$ controller
* controller etc..
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
15/99
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
16/99
'ur0e2 o 8 -it MicrocontrollersPI# 1#7A4AA+
1.Microchip technolo2 makes the PI# 1#7A4AAamil2 o 8/-it microcontroller chip
?, can run at lo:er
speed to sa0e ener2
C.The2 ha0e rom 71< to < 3 o $%M
B.
-
7/26/2019 Lecture Unit1 Mca
17/99
Comparison of the 8051 FamilyMembers
$%M t2pe
86C1 no $%M 86 mask $%M
8E &P$%M
89 5lash &&P$%M
89
8971 897#11
It uses either U erasa-le orelectronicall2 erasa-le memor2 or
permanent storae
Upto E8 -2tes o $M Upto C M>? clock re=uenc2
-
7/26/2019 Lecture Unit1 Mca
20/99
8671 5amilies and eatures
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
21/99
MotorolaGs 8>#11 5eatures
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
22/99
!hat is &m-edded '2stemHHH"
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
23/99
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
24/99
#haracteristics o &m-edded s2stem
'inle 5unctioned+ n &m-edded '2stem can eecute a speciic unctionrepeatedl2 i.e., dedicated unction. s an eample, ir conditioner :ill -e coolin
the room. #oolin is its dedicated unctionalit2 and it cannot -e used or an2other purposes.
Tihtl2 #onstraint + !hate0er s2stem is -ein desined, the2 ha0e constraints.
&m-edded '2stems are also tihtl2 constraint in man2 aspects. 5e: aspects are
-ein anal2?ed here. 1. Manuacturin #ost
-
7/26/2019 Lecture Unit1 Mca
25/99
#omple lorithms + The processor inside the em-edded s2stem shouldperorm operations that are comple in nature. n eample is diital camera. It
is used to take color photoraphs, motion pictures, -lack and :hite pictures, etc.
User Interace + >ere too :ith an eample the concept can -e eplained.
%I mo-ile phones are 0er2 -i hit in market riht, !h2" !hat is thereason" Is that -ecause other mo-ile did not perorm :ell" o, is the ans:er.
okia had ecellent and simple user interace. #alls can -e made and recei0ed
0er2 easil2. T2pin 'M' is also easierH 'o it has -een read -2 the people 0er2
:ell.
'o desinin s2stem :ith easier and comorta-le interace is most important.
lso it should ha0e options re=uired or the operation o the de0ice. &le isTM machineK it has ot comorta-le interaces and options. eep it in mind
and desin the s2stem.
Multi $ate+ &m-edded '2stems need to control and dri0e certain operations atone rate and certain other operations at dierent rate. &le can -e Diital
#amera. It is used to take pictures :hich are still. lso it is capa-le o shootin
0ideo. 'o it has to -e capa-le o dri0in the irst operation rom a speed dierent
than the second one.
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
26/99
*imitations o 8 -it Microcontrollers
Data -us :idth limits speed o eecution
ddressa-le memor2 is limited or i0en application
er2 small $M 5lash memor2
Does not ha0e hih perormance interrupt s2stem
Does not ha0e DM cache memor2 or aster
eecution
Does not ha0e memor2 protection unit MPU
Does not ha0e protected modes o operation #an not implement $T%' :hich current need o
em-edded s2stem
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
27/99
Three criteria in Choosing aMicrocontroller
meetin the computin needs o the task eicientl2 andcost eecti0el2 speed, the amount o $%M and $M, the num-er o I4% ports
and timers, si?e, packain, po:er consumption
eas2 to uprade cost per unit
oise o en0ironment
a0aila-ilit2 o sot:are de0elopment tools
assem-lers, de-uers, # compilers, emulator, simulator,technical support
:ide a0aila-ilit2 and relia-le sources o themicrocontrollers
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
28/99
5eatures Taken into consideration selectin
an Microcontrollers
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
29/99
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
30/99
$oll % Microcontroller In
&m-edded '2stem
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
31/99
5acts and iures o &m-edded
'2stem
L%0er B -illion em-edded processors :ere
sold last 2ear and the lo-al market is
:orth 6 -illion :ith annual ro:thrates o 1BN.
L5orecasts predict more than 1 -illion
em-edded de0ices -2
-
7/26/2019 Lecture Unit1 Mca
32/99
ro:th $ate
Lutomoti0e (CN),
LIndustrial utomation (
-
7/26/2019 Lecture Unit1 Mca
33/99
$ole o &m-edded '2stem
L5or eample, in the case o a modern car,-2
-
7/26/2019 Lecture Unit1 Mca
34/99
>ard:are 'ot:are Tools ssem-ler e MP'M ree
#ompilers #18,>i Tech,I$,'D## ##',micro# Do not use Mikro#initiall2
ID& MP*3 or PI# ree
'imulators -uilt in :ith ID& or Proteus, PI# 'imulator
as separate -ut not ree Prorammer, -oot loader no special prorammer in
PI#185B776,U'3 prorammin is desira-le
De0elopment -oard is 0er2 useul or learnin testin
the prorams independentl2 on ne: controller should-e lo: cost
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
35/99
'ot:are and hard:are tools or de0elopment o
microcontroller
Levels of Programming Languages
1) Machine Language Consists of individual instructions that will be
executed by the CPU one at a time
2) ssembly Language !Low Level Language) "esigned for a s#eci$c family of #rocessors !di%erent
#rocessor grou#s&family has di%erent ssemblyLanguage)
Consists of symbolic instructions directly related tomachine language instructions one'for'one and areassembled into machine language(
) *igh Level Languages e(g( + C, C-- and .basic
"esigned to eliminate the technicalities of a#articular com#uter(
/tatements com#iled in a high level language ty#icallygenerate many low'level instructions(
-
7/26/2019 Lecture Unit1 Mca
36/99
d0antaes o ssem-l2 *anuae
1( /hows how #rograminterfaceswiththe #rocessor, o#erating system, and0/(
2( /hows how datais re#resentedand
storedin memory and on externaldevices(
( Clari$es how #rocessoraccessesandexecutesinstructions and howinstructions access and #rocess data(
3( Clari$es how a #rogramaccessesexternal devices(
-
7/26/2019 Lecture Unit1 Mca
37/99
>ierarch2 o *anuaes
-
7/26/2019 Lecture Unit1 Mca
38/99
#ompiler and ssem-ler
-
7/26/2019 Lecture Unit1 Mca
39/99
Tools used or ssem-l2 *anuae
de0elopment
&ditor
ssem-ler
*inker
*oader
De-uer
&mulator
-
7/26/2019 Lecture Unit1 Mca
40/99
-
7/26/2019 Lecture Unit1 Mca
41/99
&ditor
It helps the user to create a ile thatcontains assem-l2 lanuae statements
The editor stores the '#II codes or theletters and num-ers in the successi0e $Mlocations
The ile is called as the source ile and an
'M etension is i0en to it &le o editor ; :ordpad,
notepad,:ordstar etc
-
7/26/2019 Lecture Unit1 Mca
42/99
ssem-ler
ssem-ler is a proram :hich translates themnemonics into correspondin -inar2 codes.
%peration o ssem-ler
1) It reads the source ile o proram
-
7/26/2019 Lecture Unit1 Mca
43/99
*inkers
*inker is a proram :hich is used or Ooininman2 o-Oect iles into one lare o-Oect ile
'earches proram li-raries to ind li-rar2
routines used -2 the proram*i-rar2+ collection o pre/:ritten unctions and
su-routines made a0aila-le to perorm commonl2re=uired acti0ities
Determines the memor2 locations that code rom
each module :ill occup2 and relocatesinstructions -2 adOustin a-solute reerences
$esol0es reerences amon iles
*a$ter 1: Pro%ran% ;oo"s 1:-4<
-
7/26/2019 Lecture Unit1 Mca
44/99
*inkin
*a$ter 1: Pro%ran% ;oo"s 1:-44
)=ect
f"e or o=ect
o&u"e
)=ect f"e
"rar#
E'ecuta"e
f"e!n3er
-
7/26/2019 Lecture Unit1 Mca
45/99
*ocator
The locator is a proram :hich is used
or assinin the speciic address o the
locations :here the sements o theo-Oect code are to -e loaded into the
memor2
-
7/26/2019 Lecture Unit1 Mca
46/99
De-uer
sot:are tool that is used to detect the
source o proram -2 perormin step/
-2/step eecution o application codeand 0ie:in the content o code
0aria-les.
It is a proram :hich permits the user toload o-Oect code into s2stem memor2,
eecute the proram and de-u it.
-
7/26/2019 Lecture Unit1 Mca
47/99
&mulator
&mulator is used to test and de-u the
hard:are and sot:are o an eternal
s2stem.
D " ""
-
7/26/2019 Lecture Unit1 Mca
48/99
D%ta" stora%e osc""osco$e A digital storage oscilloscope s an osc""osco$e *c* stores an& ana"#ses t*e
s%na" &%ta""# rat*er t*an usn% ana"o%ue tec*n>ues. It s no t*e ost coon
t#$e of osc""osco$e n use ecause of t*e a&2ance& tr%%er stora%e &s$"a# an&
easureent features *c* t t#$ca""# $ro2&es.
;*e n$ut ana"o%ue s%na" s sa$"e& an& t*en con2erte& nto a &%ta" recor& of t*e
a$"tu&e of t*e s%na" at eac* sa$"e te. ;*e sa$"n% fre>uenc# s*ou"& e not
"ess t*an t*e (#>ust rate to a2o& a"asn%. ;*ese &%ta" 2a"ues are t*en turne&
ac3 nto an ana"o%ue s%na" for &s$"a# on a cat*o&e ra# tue ,R; or
transfore& as nee&e& for t*e 2arous $oss"e t#$es of out$ut?">u& cr#sta"
&s$"a# c*art recor&er $"otter or netor3 nterface. )sc""osco$es are t*e &e2ces
for testn% s%na" 2o"ta%es n fe"&s suc* as e"ectronc easureent crcut
&eu%%n% &es%nn% testn% n anufacturn% %enera" testn% an& researc*es.
You can use t*e a&2anta%es of t*e to ca$ture t*e co$"e' s%na"s an& atc* t*e
on t*e screen of t*e &%ta" osc""osco$es. 7oe2er &%ta" stora%e osc""osco$es
,D+) can stora%e t*e a2efor so t eas# for us to ca$ture f"eetn% s%na"s.
06/09/16 DYPIEMR AKURDI-44
* i l
-
7/26/2019 Lecture Unit1 Mca
49/99
*oic nal2?er
A logic analyzer s an e"ectronc nstruent t*at ca$tures an& &s$"a#s u"t$"e s%na"s fro a
&%ta" s#ste or &%ta" crcut. A "o%c ana"#@er a# con2ert t*e ca$ture& &ata nto tn%
&a%ras $rotoco" &eco&es state ac*ne traces asse"# "an%ua%e or a# corre"ate asse"#
t* source-"e2e" softare. !o%c Ana"#@ers *a2e a&2ance& tr%%ern% ca$a"tes an& areusefu" *en a user nee&s to see t*e tn% re"atons*$s eteen an# s%na"s n a &%ta"
s#ste.
!o%c ana"#@ers can unco2er *ar&are &efects t*at are not foun& n su"aton. ;*ese $ro"es
are t#$ca""# too &ffcu"t to o&e" n su"aton or too te consun% to su"ate an& often
cross u"t$"e c"oc3 &oans
!o%c ana"#ser t#$es
Modular loic anal2?ers + ;*s t#$e of "o%c ana"#ser s $roa"# *at a# e t*ou%*t of as
t*e ost t#$ca" for of test nstruent a"t*ou%* t s t*e *%*est cost o$ton $ro2&n% t*e
*%*est "e2e" of functona"t#. It co$rses a c*asss an& t*e 2arous o&u"es - nc"u&n% c*anne"
o&u"es. ;*e nuer of o&u"es en% "ar%er for t*e *%*er c*anne" counts.
Porta-le loic anal2?ers + In a nuer of nstances t*ere a# e a nee& for a sa""er ana"#ser
$oss"# for restrcte& u&%ets or for fe"& ser2ce. ;*ese test nstruents ncor$orate a""
e"eents of t*e ana"#ser nto a sn%"e o' for ease of trans$ortaton.
P# -ased loic anal2?ers+ ;*ere s a %ron% nuer of P ase& "o%c ana"#sers. ;*ese
consst of an ana"#ser unt t*at s connecte& to a P. U+ s an o2ous o$ton for t*s ut
Et*ernet s a"so &e"# use& ecause of ts *%* s$ee&. ;*s for of P ase& nstruent uses
t*e $rocessn% $oer of t*e P cone& t* ts &s$"a# to re&uce t*e cost of t*e o2era""
s#ste.
06/09/16 DYPIEMR AKURDI-44
! " 3 *
-
7/26/2019 Lecture Unit1 Mca
50/99
!o%c ana"#ser 3e# c*aracterstcs ;*ere are se2era" 3e# c*aracterstcs of a "o%c ana"#ser t*at se$arate t fro u"t-
c*anne" osc""osco$es an& ot*er test nstruentsB
Pro0ide a time displa2 o loic states+ !o%c ana"#sers $ossess a *or@onta" te a's
an& a 2ertca" a's to n&cate a "o%c *%* or "o states. In t*s a# a $cture of t*e&%ta" "nes can e eas"# &s$"a#e&.
Multiple channels+ !o%c ana"#@ers are &es%ne& to ontor a "ar%e nuer of &%ta"
"nes. As "o%c ana"#@ers are o$t@e& for ontorn% a "ar%e nuer of &%ta" crcuts
t#$ca""# t*e# a# *a2e an#*ere eteen aout
-
7/26/2019 Lecture Unit1 Mca
51/99
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
52/99
D'% *oic nal2?er
To see clock re=
To see control sinals like 'D,'#, *& etc
To see data address line on *
Trierin or time or state domain nal2sis
P# -ased * is cheaper than 'tand alone
To see port output hih lo: or *&D, $ela2 etc
To see P!M output on D'%
To see s=uare :a0e or other :a0eorms
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
53/99
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
54/99
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
55/99
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
56/99
UIT ) and a lo: -2te (DP*). Its
unction is to hold a 1 -it address. Itma2 -e manipulated as a 1 -it data
reister or t:o independent 8 -it
reister. It ser0es as a -ase reister inindirect Oumps, lookup ta-le instructions
and eternal data transer.
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
77/99
P$%$M 'TTU' !%$D (P'!)
C3 AC ! RS% RS! O. P
DYPIEMR AKURDI-44
RS! RS% &A5 S#6#CIO5
0 0 007 0:7 A(K0
0 1 07 07 A(K 1
1 0 107 1:7 A(KC
1 1 17 17 A(K .!hen 8671 po:ered up,
the 'P reister contains0alue 6E.
:7
-
7/26/2019 Lecture Unit1 Mca
79/99
Memor2 %rani?ation The 8671 memor2 orani?ation is rather comple.
The 8671 has separate address spaces or Proram Memor2, Data Memor2, andeternal $M.
This is reereed to as a>ar0ard architecture.
The earl2 Mark I (19BB) computer de0eloped at>ar0ard:as o this t2pe oarchitecture.
on eumannat Princeton pointed out that it :as not necessar2 to put
instructions and data in separate memories. Most machines ha0e -eenPrinceton architecture.
$ecentl2 >ar0ard architecture has -een emplo2ed to help alle0iate thememor2 -ottleneck.
3oth proram memor2 and eternal data memor2 are 8 -its :ide and use 1 -itso address. The internal data memor2 is accessed usin an 8/-it address.
'ince the same address can reer to dierent locations the speciic location isdetermined -2 the t2pe o instruction.
06/09/16 DYPIEMR AKURDI-44
Proram or #ode Memor2
-
7/26/2019 Lecture Unit1 Mca
80/99
Proram or #ode Memor2
Ma2 consist o internal or eternal proram memor2. The amount o
internal proram memor2 0aries dependin on the de0ice. B -2tes t2pical in older de0ices.
The 'ilicon *a-s #86715C16 contains 1 o lash memor2 orprorams.
The 'ilicon *a-s #867156) F #M(6,H,5555>K E,H,6)
This notation can -e used to speci2 particular -its and -2tes o codememor2.
5or eample #M(1) reers to the -2te o code memor2 at address 1.#M(1KE) reers to the most siniicant -it in that address.
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
81/99
M
M)5 AHA DP;R AM,ADP;R
M)5 AHA P AM,AP
PCJ P,1F..0
'PRJ DP;R,1F..0
06/09/16 DYPIEMR AKURDI-44
&ternal Memor2
-
7/26/2019 Lecture Unit1 Mca
82/99
'upports up to B -2tes eternal memor2.AM(6666,H,5555)
F AM(6666,H,5555K E,H,6)ccessed -2 usin the M%A instruction.
%n the oriinal usin eternal memor2 reducesnum-er o a0aila-le I4% ports.
%n some ne: de0ices this is not the case. 5or eample in #867156
-
7/26/2019 Lecture Unit1 Mca
83/99
2
The oriinal 8671 had 1
-
7/26/2019 Lecture Unit1 Mca
84/99
Data eor#
M
DMM)5 A6C7
M)5 R1L6C7
M)5 AHR1
M)5 A0AC7
M)5 R1L0AC7
M)5 AHR1
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
85/99
Data Meor# ,DM06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
86/99
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
87/99
DYPIEMR AKURDI-44
Intel 8671+ Timers4#ounters
06/09/16
Ti
-
7/26/2019 Lecture Unit1 Mca
88/99
Timer timer is a counter that is
increased :ith e0er2 time an
instruction is eecuted e.. 8671
:ith 1? increases a counter
e0er2 1.666 Qs
eneral 8671 has C timer+
< 1/-it timer
1 1/-it timer :ith
etra/unctionalit2(introduced :ith the
867
-
7/26/2019 Lecture Unit1 Mca
89/99
DYPIEMR AKURDI-44
- Inter2a" ;n%
- Pero&c e2ent tn%
- ;e ase for easureents
- E2ent ountn%-au& Rate Generaton
+!*% imers
- C ters ,;er 0 an& ;er 1
- 16-t ters ,6FF
-
7/26/2019 Lecture Unit1 Mca
90/99
ate + !hen set, timer onl2 runs :hile IT(6,1) is hih.
#4T +#ounter4Timer select -it.
M1 + Mode -it 1.
M6 + Mode -it 6.
06/09/16 DYPIEMR AKURDI-44
T#% $eister+
-
7/26/2019 Lecture Unit1 Mca
91/99
T51+ Timer 1 o0erlo: la. T$1+ Timer 1 run control -it.
T56+ Timer 6 o0erla. T$6+ Timer 6 run control -it.
I&1+ &ternal interrupt 1 ede la. IT1+ &ternal interrupt 1 t2pe la.
I&6+ &ternal interrupt 6 ede la. IT6+ &ternal interrupt 6 t2pe la.
T5+ %0erlo: la
'et -2 hard:are on Timer4#ounter o0erlo:
#leared -2 hard:are :hen processor 0ectors to interrupt routine
T$+ $un control -it
'et4#leared -2 sot:are to turn Timer4#ounter on4o
I&+ Interrupt &de la
'et -2 hard:are :hen eternal interrupt ede detected #leared :hen interrupt processed
IT+ Interrupt T2pe control -it
'et4#leared -2 sot:are to speci2
allin ede4lo: le0el triered eternal interrupts
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
92/99
;o ounter/;er
Internalcloc8
#$ternal cloc8
a""n% e&%e-tr%%er
06/09/16 DYPIEMR AKURDI-44
-
7/26/2019 Lecture Unit1 Mca
93/99
DYPIEMR AKURDI-44
imer Modes
- 0B 1< t ter
- 1B 16-t ter
- CB -t auto re"oa&-
-
7/26/2019 Lecture Unit1 Mca
94/99
DYPIEMR AKURDI-44
Mode %9 %:-2it
- A"" 16 ts of t*e ter ,;70/;!0 ;71;!1 are use&.
- Ma'u count s 6FF
-
7/26/2019 Lecture Unit1 Mca
95/99
DYPIEMR AKURDI-44
Mode (9 +-2it A"to Reload
- )n"# t*e "oer #te ,;!' s use& for countn%.
- U$$er #te ,;7' *o"&s t*e 2a"ue to re"oa& nto ;!' after
an o2erf"o.
- ;' ust e anua""# c"eare&.- Ma'u count s CF6
- Ma'u nter2a" s CF6 Mcrosecon&s or .CF6
""secon&s
06/09/16
-
7/26/2019 Lecture Unit1 Mca
96/99
DYPIEMR AKURDI-44
Mode )- Split imer
- +$"ts ;er 0 nto to -t ters
- ;!0 sets ;0
- ;70 sets ;1- ;er 1 s a2a"a"e for ot*er < o&es ut t*e ;1
s not a2a"a"e.
06/09/16
-
7/26/2019 Lecture Unit1 Mca
97/99
DYPIEMR AKURDI-4406/09/16
-
7/26/2019 Lecture Unit1 Mca
98/99
DYPIEMR AKURDI-44
imer 'elay and imer Reload .al"e
Timer &elay < &elay 4alue = Timer Clock Cycle &uration
&elay 4alue < how many counts before register2s3 roll over
Timer Clock Cycle &uration < *%oscillator fre9uency
&elay 4alue < Ma(imum !egister Count > Timer !eload 4alue
Ma(imum !egister Count < *?
06/09/16
-
7/26/2019 Lecture Unit1 Mca
99/99
http+44:::.slideshare.net4aOooani4introd
uction/to/microcontrollers/
top related