Embedded Software Design 25
Embedded Software Design 25
;
I
.. ..-:---.... .
,
I
I
.....
r
'
~ ~"~!!!,r.
Information Technology
(Computer Systems & Networking)
Page 1
1.
[Total:8 marks]
Write concise notes on the following to show your understanding of the function and operation in respect of the PIC 16F84 microcontroller. You may use a diagram to support your description. Hint: You may indicate - What is it? Where is it located? What is its function? a) FSR b) EEPROM c) RPO d) Instruction Pipeline
2.
[Total:12 marks] (a) In a PIC Microcontroller crystal oscillator frequency Jose is divided by 4 in order to calculate the instruction cycle rate. Explain using a diagram, why this is done. [Total:4 marks] (b) Write a program, which will set the memory area from h'20' to h'2f to 0 using indirect addressing. [Total:4 marks]
(c) Explain the difference between SPRs and GPRs.
[Total:2 marks] (d) What are the advantages of mirrored registers? Give at least 2 examples. [Total:2 marks] - End of paper-
Page 2
TABLE 21:
SPECIAL FUNCTION
REGISTER
FILE SUMMARY
Value on
Aclclr
Bank 0 00r01tit\OF
Name
Bit 7
Bit 6
Bit 5
Bit4
Bit 3
Bit 2
Bit 1
Bit 0
Power-On
RESET
Details on paae
Uses cooten.s of FSR 10 acorsss Data Mel'1ory (no: a physical reQister) 8-bit Real-Time ClocklCounter Low Order 8 brts of the Program Counter (PC) IRP RP1 R?O TO RA4lTOCKI RB4 PO
- - -- - - -xxxx xxxx
0000 0000
11 20 11
021'
03h
Z
RA2 RS2
DC
RA1
RB7
RB6
RB5
RA3
RB3
RB1
,... '-,
e
11 16 18
OTh
Unimptsmanted
xxx.x
XXX):
13.14 13.14 11 10 11
OBr
Otm
OA.h aSh
xxxx xxxx
Wrtte Buffer for upper 5 bits of the INTE RBIE TGIF
GIE
EEIE
TOlE
ce
Ci) RsrF
- --0 OCi00
0000
'JOOx
- -- 1111 0000
Bank 1
801'
81r 82n
Uses Contents of FSR to address Dat;] Memory (not RBPU INTEDG TaCS TOSE PSA
a physical
PS2
- --PSO
1111 0000
9
11
8.2or~,4r
occi
>:XXX - --1 1111
lXX>: xxxx
1111 1111
e
11 16 18
8:~
85r
87h SSt'
EEIE
13 14 11 10
GIE
TOlE
EEIF
xecc
.. ......
01)(,0
89"
OAll aSh
:::EPROM Control Register 2 (not a physical iaglster) Wnte buffer for upper 51lilS of !he PCP) JNTE RBIE TGIF INTF RBfF
..
.. _ .....
- --0 0(1)1)
'JO('X
Legend: x unknown. u uncoanceo. - = unlrnpternented, read as G'. q = value depends on condition Note 1: The oper by~eof the oroqrari counter Is not directly accessible. PCLA.TH is a slave register for PC<-12:8:o, The contents o PCLAJH can be transferred :0 the upper I)yte otthe oroora counter, but the contents of PC<12:8> are never transferred to ::>CLATH. 2: The TO and PO status bits in t ,e STATUS register are not affected b)' a MCLR Reset. 3: Other ( .on POW6Htp) RESETS include: extemal RESET through MC R and the watc dog Timer Reset 4: On any device RESET, these pins are configured as inp is. 5: TI)is Is the value U1a! will t)e JIl the con output latch.
Page 3
TABLE 7-2:
PIC16CXXX INSTRUCT10N
SET
14-Bit Opcocle Status Affected
II
Mnemonic, Operands
Description
Notes
BYTEORIENTED ADD'NF A.f\D'/'.'F CL~F CL~'lv' C:JMF 'OECF OECFSZ INCF INCFSZ IOR'NF MOVF
FILE REGISTER
OPERATIONS
00 0111 0101
f. d
t. d
f
r. d
f.d f. d f. d f. d Cd f. d f
Como-emeut f
Decre'nen: Decremer,! f ', Sl<;;p if
1 1 1 1 1 1 1 (2) 1 1 12) 1 1 1 1 1 1 1 1
00
00 C'O 00
c-io r
0001 1001 0011 1')11 1,nD 1111 C'100 100e'
OOQO
00 00
00 C'O 00 00 00 00
MOV.'.F
il<OP
RL=
.
f. d f. d f.d f..d
RR"
SlB"'''''F S'IV:"PF XO~'I;F
Increment f Increment f. Skip if 0 Inclusive OR W wim f Mo\>e f Move'N to f No ooerauon Rotate Leftf through Carry Rotate Rlgh: f through Carfy Subtract W from f Swap nibbles in r Exdusive OR VI/ wl:h f BITORIENTED FILE REGISTER
dfff ffff c.uff ffff lttf fft!: xxxx 0= dfff fiff drff fftf dfff ffff dftf ffff dfff ffff dfff ffff dfff ffff Iff! tfff
C,OC,l
1.2 1.2
Z
Z
2
1.2 1,2
Z
Z
1.2.3
Z Z
Z
1.2
1.2.3
1.2 1,2
oxxo
dffE dfff dfff dfff dfft
(01)0
00
0) 00 00 00
r. d
f.b
C
C C.DC.l
OPERATIONS 1
01 01
f. b
L b
f.1l
Clear r Set f Test f, Skip if Clear Test t, Skip if Set LITERAL AND CONTROL
1 1 [2J
1 (2)
01
01
pfff
bfff bfff
PffE
fHf fiff
ffff
1,2 1.2
ffff
C,DC,l Z TOPO
3 3
OPERATIONS 1
11
~
i<
1.;
1i
~ ~
><:
.
k
Ad~ literal and W AND lite 3' With "f'.' Call subroutine Clear V\,a:chOog T~mer Go to address Inclusive OR. 'iteralwith '."" r''''o~e literal to '/,' RI:i:urn rrorn imerrIJpt Re:u"n with 1i:eraln '1'1 Re:urn from subrocane Go ';1110 standl)Y Mode Subtract .. "'. frOM !rleral Excillsi'/e OR literal with V,,'
lllX
1001
11
10 0'1 10 11 11
2
1
ckkk
0000 1Jd:k 1000
2
1 1
2
kkkk
kkkk kr...kk
0000
ooxx
0(1)0 OllO'. 0,)00
COO
11
2
2
1 1 1
kkkk
0000
kklck
1000
00
00 11 11
0011
TOPD
kkkk
kkkk kkkk
C,DC.l Z
1: wnen an 110 register JS~odlfled as J functton ()f itself:: e.:;).,NOVE' PORTS. 1), the value used Will be that ... alue oreser: on the oins themselves. For example. if ~r,e oa:a latch is '1' for a p'n configured as inpu and is driven 10\1. I)y an e.<t..:rnal
2: 3: device, ~he oata Will be written bacK with a '0'. If .rns instruction is executed on 1'e TMRO register (and, wr-ere applicable. 0 = 1). the prescaler will oe cleared if Jssigned to :he T.merO MOdule. If .:>:-ogram Counter (PC) is modffied or a conditional test is true. the mstrucuon requires two cycles. The second cycle is executed as a J-!<)P
Page 4