0% found this document useful (0 votes)
28 views

Sheet 3 Embedded System (CSE 315)

The document discusses PIC architecture and assembly language programming. It covers topics like PIC registers, instructions, data types, memory spaces. It contains questions to test understanding with answers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Sheet 3 Embedded System (CSE 315)

The document discusses PIC architecture and assembly language programming. It covers topics like PIC registers, instructions, data types, memory spaces. It contains questions to test understanding with answers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Mansoura University

Faculty of Engineering Embedded Systems (CSE 315)


Communications and Computer Sheet (3)
Engineering (CCE)

Sheet (3)
Chapter 2: PIC ARCHITECTURE & ASSEMBLY LANGUAGE PROGRAMMING
Part I: True or False

1. Assembler directives are not used by the CPU itself. They are simply a guide to the assembler.
2. No value can be moved directly into the WREG register.
3. We have many WREG registers in PIC18.
4. Data RAM in PIC is also called the file register.
5. The larger the file registers, the more difficult it is to manage.
6. No value can be moved directly into general-purpose RAM.
7. Instructions such as “ADD WREG, ROM memory” do not exist in RISC microcontrollers such as the
PIC18.
8. While CISC instructions are of variable sizes, RISC instructions are all the same size.
9. Harvard architecture uses the same address and data buses to fetch both code and data.
10. All members of the PIC18 family have the same size file register.
11. The SFRs are part of the file register memory space.
12. General-purpose RAM is not part of the file register memory space.
13. The more file register space that is assigned to the SFRs, the less is available for the GP RAM.
14. The access bank is 256 bytes divided evenly between GPRs and SFRs.
15. The source file has the extension ".asm".
16. We cannot load literal values into the scratchpad area directly.
17. We can use MOVFF to copy data from any location to any location in the file register.
18. The source code file can be a non-ASCII file.
19. Every source file must have ORG and END directives.
20. The ORG and END directives appear in the ".lst" file.
21. The linker produces the file with the extension ".asm".
22. The linker produces the file with the extension ".hex".

Page 1 of 5
Mansoura University
Faculty of Engineering Embedded Systems (CSE 315)
Communications and Computer Sheet (3)
Engineering (CCE)

20. The “ADDWF fileReg, D” instruction involves a fileReg and WREG.

Part II: Multiple-choice questions (MCQ)

1. PIC 18 is a(n) ---------- bit microcontroller.


A. 4 B. 8 C. 16 D. 32

2. The register WREG is ----------- bit wide.


A. 4 B. 8 C. 16 D. 32

3. The literal value in MOVLW is --------- bits wide.


A. 4 B. 8 C. 16 D. 32

4. The largest number that can be loaded into WREG is ---- in hex and decimal equivalent -----
A. 99 - 63 B. 63 - 99 C. FF - 256 D. FFF - 4095

5. To load WREG with the value 65H, the pound sign is --------- in the instruction
"MOVLW #65 H".
A. not necessary B. optional C. necessary D. None of the mentioned

6. The largest number that K can take for the instruction “ADDWL K” is --------- in hex.
A. F B. FF C. FFF D. None of the mentioned

7. PIC data RAM consists of ------------.


A. EEPROM B. SRAM C. both D. None of the mentioned

8. Which of the following is (are) illegal?


A. MOVLW 500 B. MOVLW 50 C. MOVLW 00 D. MOVLW 255H
E. MOVLW 25H F. MOVLW F5H G. MOVLW my byte, 50H

9. Which of the following is (are) illegal?


A. ADDLW 300H B. ADDLW 50H C. ADDLW $500 D. ADDLW 255H
E. ADDLW 12H F. ADDLW 0F5H G. ADDLW 25H

10.The access bank has -------------- bytes space.


A. 16 B. 64 C. 128 D. 256

Page 2 of 5
Mansoura University
Faculty of Engineering Embedded Systems (CSE 315)
Communications and Computer Sheet (3)
Engineering (CCE)

11.What is the maximum number of banks that the PIC18 can have?
A. 4 B. 8 C. 16 D. 32

12.If we add the SFR and general-purpose RAM sizes together we should get the total space
for the …….
A. File Register B. ROM C. EEPROM D. All of the mentioned

13.The vast majority of registers in the PIC are ------------- bit.


A. 4 B. 8 C. 16 D. 32

14.The SFR registers in PIC are ------------- bit.


A. 4 B. 8 C. 16 D. 32

15.The maximum number of bytes that the PIC18 can have for the file register -------------
A. 1024 B. 2048 C. 4096 D. 8192

16.The file register of PIC 18 in general consists of 16 banks, each of ------------- bytes.
A. 16 B. 64 C. 256 D. None of the mentioned

17.“ADDWF PORTB, W” puts the result in -------------


A. PORTB B. scratchpad C. WREG D. None of the mentioned

18.The flag register in the PIC is called the -------------


A. SFR B. General Purpose RAM C. Status register D. None of the mentioned

19.The “ADDWF fileReg, D” instruction to place the result in WREG, the D bit must be ---.
A. 0 B. W C. both A and B D. None of the mentioned

20. The “ADDWF fileReg, D” instruction to place the result in FileReg, the D bit must be -.
A. 1 B. F C. both A and B D. None of the mentioned

Page 3 of 5
Mansoura University
Faculty of Engineering Embedded Systems (CSE 315)
Communications and Computer Sheet (3)
Engineering (CCE)

Part III: Written Questions

1. What is the result of the following code and where is it kept?


MOVLW 15H
ADDLW 13H
2. What is the result of the following code and where is it kept?
MOVLW 25H
ADDLW 1FH
3. What is the result of the following code and where is it kept?
MOVLW 15H
ADDLW 0EAH
4. What is the difference between the EEPROM and data RAM space in thePIC18?
5. Can we have a PIC chip with no EEPROM?
6. Can we have a PIC chip with no file register?
7. Show a simple code to load values 30H and 97H into locations 5 and 6 respectively.
8. Show a simple code to load value 55H into locations 0-8.
9. Show a simple code to load value 5FH into Port B SFR
10.Show a simple code to
(a) load value 11H into locations 0-5
(b) add the values together and place the result in WREG as they are added.
11.Repeat Problem 10, except place the result in location 5 after the addition is done.
12.Show a simple code to:
(a) load value 15H into location 7.
(b) Add it to WREG five times and place the result in WREG as the values are added.
WREG should be zero before the addition starts.
13.Repeat Problem 12, except place the result in location 7 as numbers are being added
together.
14.What is the difference between the MOVWF and MOVF instructions?
15.Write a simple code to complement the contents of location 8 and place the result in
WREG.

Page 4 of 5
Mansoura University
Faculty of Engineering Embedded Systems (CSE 315)
Communications and Computer Sheet (3)
Engineering (CCE)

16.Write a simple code to copy data from location 8 to PORTC


(a) using WREG
(b) without using WREG

With my best wishes

Dr. Mohammed Kamal

Page 5 of 5

You might also like