Beruflich Dokumente
Kultur Dokumente
Dr JBO
College of Engineering
Subject Code
Course Title
Date
Time Allowed
:
:
:
:
EEEB373/4
Microprocessor Systems
31st July 2007
50 minutes
GOOD LUCK!
a) Decimal
Answer:
[4 marks]
c) Binary
Answer:
10011000010
[4 marks]
d) Octal
Answer:
2302
[2 marks]
e) Hexadecimal
Answer:
4C2
[2 marks]
[2 marks]
Show your detailed work here! You will get full marks when detailed works are shown.
Decimal 1218
[1]
[1]
[1]
[1/2]
[1/2]
BCD
Change each decimal 1218 digit to 4-bit = 0001 0010 0001 1000
Binary
1218/2 = 609
609/2 = 304
304/2 = 152
152/2 = 76
76/2 = 38
38/2 = 19
19/2 = 9
9/2 = 4
4/2 = 2
2/2 = 1
1/2 = 0
Remainder 0
Remainder 1
Remainder 0
Remainder 0
Remainder 0
Remainder 0
Remainder 1
Remainder 1
Remainder 0
Remainder 0
Remainder 1
[2 marks]
Octal
or
Hex
or
[6 marks]
Read-only memories
Programmable memory programmed by user
Erasable memory
Data stored in memory are non-volatile
[2 marks for each answer, maximum of 6 marks]
3. Describe how communication between PIC18 CPU to its program memory and data memory
are different.
[6 marks]
Answer:
PIC18 CPU communicates with its program memory using 16-bit instruction bus,
while it communicates with its data memory using 8-bit data bus. Each program
memory location is addressed using 21-bit program address, while each data memory
location is addressed using 12-bit register address. [Refer to Figure 1.3 in the note!]
[6 marks]
4. What is the purpose of access bank and bank select register (BSR) in the PIC18 CPU? Show
your calculation to determine how many banks required for a PIC18 device with 1536 bytes of
data memory.
[6 marks]
Answer:
Access bank is created to minimize the problems of bank switching when data memory
required for an operation is within the range of the access bank, which consists of the lowest
96 bytes in general-purpose registers (0x000 to 0x05F) and the highest 160 bytes of special
function registers (0xF60 to 0xFFF).
[2 marks]
Bank select register (BSR) is used to keep or store highest 4 bits of address lines of the
data memory required for an operation. This will pinpoint the exact register in a particular
bank of data memory to be operated on when the required bank is selected to be active.
[2 marks]
For 1536 bytes of data memory:
Number of memory banks required = 1536 / 256 = 6 banks.
[2 marks]
0x24
[1/4]
subwf
[1]
0x68,F,BANKED
[1/2] [1/2] [1/2]
(b) A data register is at address 0x639. You want to add its contents with the content of WREG
and the result will be saved in the data register.
[4 marks]
Answer:
Since 0x639 is not in the Access Bank, need to use BSR to access the address!
movlb
6
;Bank 6
[1]
[1/2]
addwf
[1]
0x39,F,BANKED
[1/2] [1/2] [1/2]
6. Use the PIC18 instruction set to produce machine codes (in hexadecimal) for the following
PIC18 instructions.
Machine code
lfsr
FSR2,0x786
addwf
0x32,F,A
movlw
O57
subwf
D89,F,A
Note: Answer in binary number will give half of total mark for the question. Answer in hex gets the full marks.