Professional Documents
Culture Documents
Von Neuman
Caracteristici:
Magistrala comuna
pentru memoria de
program si de date
Exemplu tipic:
Motorola HC11
Arhitectura Harvard
Caracteristici:
magistrale distincte
pentru program si date
Exemplu tipic
Atmel AVR
Harta memoriei in
cazul unui
microcontroller HC11
Harta memoriei
pentru un
microcontroller
din seria Atmel
AVR
Se observa ca aici
exista 3 spatii de
adrese
HC11
AVR
32 acumulatori R0-R31
R26R27,R28R29,R30R31
canbeconcatenatedtoformthe
X,Y,Z,registers
StackpointerSP
registruldestareCPUdenumit
SREG
Numaratoruldeprogram
Interfetele periferice
Anyperipheral
interfacecontains
oneormore
controlandstatus
registers,andone
ormoredata
registers
Theseregistersare,
normally,located
intheaddress
spaceofthedata
memory,andare
accessedasRAM
locations
Sistemul de intreruperi
Definitie:
Aninterruptisamechanismthatallowsan
externaleventtotemporarilyputonholdthe
normalexecutionoftheprogram,forcingthe
executionofaspecificsubroutine.Oncethe
interruptservicesubroutinecompletes,themain
programcontinuesfromthepointwhereitwas
interrupted.
Thenextstepistheexecutionoftheinterruptserviceroutine(ISR).
Thisisaprogramsequencesimilartoasubroutine,butendedwitha
specialinstructioncalledReturnfromInterrupt(RTI,RETI).
Observatieimportanta:STAREAmasiniitrebuiesalvataprinsoft
inaintedeexecutiarutineideintreruperesirestauratadupaexecutia
rutineideintrerupere.
Thefinalstepinhandlinganinterruptistheactualreturntothemain
program.ThisisdonebyexecutingaRTI(RETI)instructionas
mentionedbefore.Whenthisinstructionisencountered,thecontents
ofPC,savedinstep2,isretrievedfromstackandrestored,whichis
equivalenttoajumptothepointwheretheprogramwasinterrupted.
Thestackisessentialfortheinterruptsystem.BoththePCandthe
CPUstatusaresavedinthestackwhenhandlinginterrupts.
Therefore,theSPmustbeinitializedbysoftwarebeforeenabling
theinterrupts.
TheinterruptserviceroutinemustsavetheCPUstatusandrestore
itbeforereturningtothemainprogram.
Iftwoormoreinterruptrequestsoccursimultaneously,theyare
servicedinapredetermined,orderaccordingtoahardwired
priority
Conditionarea intreruperilor
TheINTERRUPTFLAGistheactualinterruptsource,and,usually,isa
flipflopsetbytheexternalevent.Thisbitis,inmostcases,accessiblefor
the program as a distinct bit in the status register of the peripheral
interface.
TheLOCALINTERRUPTMASKSarecontrolbits,locatedinthecontrol
registers of the interface. When set to1by software, the interrupts from
thatspecificinterfaceareenabled.
The GLOBAL INTERRUPT MASK is a bit located in the CPU status
register(CCR,SREG,PSW)thatenablesordisablesallinterrupts.
Insomecases,itisrequiredthattheCPUisinformedimmediatelyabout
someimportantinternalorexternalevents,regardlessofthestatusofthe
global interrupt mask. The solution to this problem is the nonmaskable
interrupt,whichisunconditionallytransmittedtotheCPU.Aspecialcase
of nonmaskable interrupt can be considered the RESET. Basically, the
behavior of the MCU at RESET is entirely similar to the process of
identificationandexecutionofanonmaskableinterrupt.
MAIN
.......
;Program
;RESET
.......
ORG
$FFFE
DW
MAIN
entry
point
at
;store
the
value
of
the
;label MAIN at $FFFE-$FFFF
.......
.ORG
RJMP
.......
ANA_COMP:
.......
RETI
$000C
ANA_COMP