Programming of Microcontroller Systems (CSCT4105)
Computer Science - COS
Semester: First Semester
Level: 400
Year: 2013
1 /3
HTTTC Bambili Computer Science Department
FINAL EXAM
Level 300
CSC 319: MICROCONTROLLERS AND APPLICATIONS
2013-2014 academic year
Duration: 2 hours
Exercise 1: Using the table below and figure 1, write an assembler program able to store in a
microcontroller, the decimal number 25, 45 and 50 respectively at position78h, 173h and 1F4h.
Exercise 2: This is an assembler program
List p=16F877, r=dec
#include “p16F877.inc”
BSF STATUS,RP0
BCF STATUS,RP1
MOVLW ‘E’
MOVWF 185h
BCF STATUS,RP0
MOVLW ‘N’
MOVWF 24h
BSF STATUS,RP1
MOVLW ‘S’
MOVWF 114h
MOVLW ‘E’
MOVWF 105h
BSF STATUS,RP0
BSF STATUS,RP1
MOVLW ‘T’
MOVWF 184h
1) Rewrite the program and explain each line.
2) What does this program do?
Exercise 2:
1. Define: Microcontroller
2. List three application of microcontrollers in Bamenda or Bambili
3. List two differences between a microcontroller and a microprocessor
4. List two major characteristics to be considered when you buy a microcontroller
www.schoolfaqs.net
2 /3
5. A microcontroller has 512 bytes as RAM memory. Can you use all that 512 bytes for your program?
Why?
6. Give the size of the RAM of figure 1.
Exercise 3: This is a program written by a student using MPLAB software:
BSF STATUS, RP0
BCF STATUS,RP1
BSF TRISB,3
BCF STATUS,RP0;
HERE:
BSF PORTB,3;
GOTO HERE
1) What can you do with this program?
2) Draw an appropriate circuit with a microcontroller, a LED, a resistor able to use this program.
3) Is the microcontroller programmed as sinking mode or source mode? Why.
Exercise 4: Give an algorithm which can help you to shine forever a LED
Table 1: Bank codes
RP1 RP0 Selected bank
0 0 Bank0
0 1 Bank1
1 0 Bank2
1 1 Bank3
Figure 1: A microcontroller RAM organization
www.schoolfaqs.net