You are on page 1of 25

IntroducingthePIC16Seriesandthe 16F84A

Chapter2 Sections18 Dr.IyadJafar

Outline
OverviewofthePIC16Series AnArchitectureOverviewofthe16F84A The16F84AMemoryOrganization MemoryAddressing SomeIssuesofTiming PowerupandReset The16F84AOnchipResetCircuit
2

OverviewofthePIC16Series
ThePIC16seriesisclassifiedasamidrange microcontroller Theserieshasdifferentmembersallbuiltaround thesamecoreandinstructionset,butwith differentmemory,I/Ofeatures,andpackagesize

AnArchitectureOverviewofthe 16F84A

18Pins/DCto20MHz/1KprogramMemory/68BytesofRAM/64 BytesofEEPROM/18bitTimer/15bitParallelPort/18bitParallel Port

AnArchitectureOverviewofthe16F84A

ThePIC16F84AMemoryandRegisters
ProgramRelated

ThePIC16F84AMemoryandRegisters
ProgramMemory
1Kx14Bits Addressrange0000H 03FFH Flash(nonvolatile) 10000erase/writecycles Location0000H isreservedfortheresetvector Location0004HisreservedfortheInterruptVector ProgramCounter Holdstheaddressofthenextinstructiontobeexecuted Stack 8levels(eachis13bits) SRAM(volatile) UsedtostorethereturnaddresswithinstructionlikeCALL, RETURN,RETFIE,andRETLW(interruptsandprocedures)
8

InstructionRegister Holdstheinstructionbeingexecuted

ThePIC16F84AMemoryandRegisters
TheConfigurationWord
Aspecialpartoftheprogrammemory Allowstheusertoconfiguredifferentfeaturesofthemicrocontrollerat thetimeofprogramdownload Isnotaccessiblewithintheprogramorwhileitisrunning

ThePIC16F84AMemoryandRegisters
DataMemoryandSpecialFunction Registers(SFRs) SRAM(volatile) Bankedaddressingtoreduce addressbussize SpecialFunctionRegistersSFRs
Locations01H0BHinbank0and 81H 8BH inbank1 UsedtocommunicatewithI/Oand controlthemicrocontrolleroperation SomeofthemholdI/Odata

GeneralPurposeRegisters
10

Addresses0CH 4FH (68Bytes) Usedforstoringgeneraldata

ThePIC16F84AMemoryandRegisters
SpecialFunctionRegisters(SFRs)

11

ThePIC16F84AMemoryandRegisters
SpecialFunctionRegisters(SFRs)interactingwith peripherals

12

ThePIC16F84AMemoryandRegisters
TheWorkingRegister
InsidetheCPU HoldstheresultofthelastinstructionexecutedbytheCPU

13

ThePIC16F84AMemoryandRegisters
DataMemoryAddressing
ForPIC16F84A,weneedtoselectoneoftwobanks(1bit) and7bitstoselectonofthelocations Bankselectionisdonethroughusingbits5and6ofthe STATUSregisters(RP0andRP1) Forthe16F84A,onlyRP0isneededsincewehavetwo banks Ingeneral,twoformstoaddresstheRAM(FileRegisters)
Directaddressing the7bitaddressispartoftheinstruction Indirectaddressing the7bitaddressisloadedinFileSelect Register (FSR,04H)

14

ThePIC16F84AMemoryandRegisters
DataMemoryAddressing

15

ThePIC16F84AMemoryandRegisters
TheSTATUSRegister(03H,83H)

16

ThePIC16F84AMemoryandRegisters
DataRelated
EEPROMDataMemory
64bytesNonvolatile 10000000erase/writecycles Usedtostoredatathatislikelytobeneededforlongterm OperationiscontrolledthroughEEDATA(08H),EEADR(09H),EECON1 (88H),andEECON2(89H) SFRs Toreadalocation storetheaddressinEEADRandsettheRDbitinEECON1 dataiscopiedtoEEDATAregister Towritetoalocation dataandaddressareplacedinEEDATAandEEADR,respectively enablewritingbysettingtheWREN bitinEECON1SFR store55HthenAAHinEECON2 commitwritingbyenablingtheWRbit Oncethewriteisdone,theEEIFflagissetinEECON1.

17

ThePIC16F84AMemoryandRegisters
TheEECON1Register(88H)

18

SomeIssuesofTiming
TheClock
Themicrocontrollerismadeupofcombinationalandsequentiallogic. Thus,itrequiresaclock! Clock acontinuouslyrunningfixedfrequencylogicsquarewave Timers,counters,serialcommunicationfunctionsarealsodependent ontheclock Operatingfrequencyhasdirectimpactonpowerconsumption Everymicrocontrollerhasarangeforitsclock

19

SomeIssuesofTiming
InstructionCycle
Themainclockisdividedbyafixedvalue(4inthe16 series)intoalowerfrequencysignal Thecycletimeofthissignaliscalledtheinstructioncycle Theprimaryunitoftimeintheactionofprocessor

20

SomeIssuesofTiming
Pipelining
Everyinstructioninthecomputerhastobefetchedfrommemoryand thenexecuted.Thesestepsareusuallyperformedoneafteranother TheCPUcanbedesignedtofetchthenextinstructionwhileexecuting thecurrentinstruction.Thisimprovesperformancesignificantly! ThisiscalledPipelining AllPICmicrocontrollersimplementpipelining(RISC+Harvardmakeit easy)

21

PowerupandReset
Onpowerup,themicrocontrollermuststarttoexecuteprogram storedintheprogrammemoryfromitsbeginning(address0000H) Aspecializedcircuitinsidethemicrocontrollerdetectsthisandis responsibleforputtingthemicrocontrollerintheresetstate:
theprogramcounterissettozero theSFRsaresetsuchthattheperipheralsareinsafeanddisabled

Anotherwaytoputthemicrocontrollerintheresetstateistoapply logiczerototheMasterClearinput(MCLR) Someresetcircuitconfigurations

22

The16F84AonChipResetCircuit
Logic 1 on this activates the Reset Signal

Logic 1 on this input deactivates the Reset Signal and causes the microcontroller to exit the reset state 23

The16F84AonChipResetCircuit
ExampleonresettimingwhenMCLRisconnectedtoVDD

24

Summary
ThePIC16F84Aseriesisadiverseandcosteffective familyofmicrocontrollers ThePIC16F84AispipelinedRISCprocessorwith Harvardarchitecture ThePIC16F84Ahasthreedifferentmemorytypes AnimportantmemoryareaistheSpecialFunction RegisterareawhichactaslinkbetweentheCPUand peripherals Resetoperationmustbeunderstoodforproper operationofthemicrocontroller
25

You might also like