Sunteți pe pagina 1din 2

COMSATS University Islamabad

Sessional-1 Examination Booklet


 
 
 
CLO1: Demonstrate an understanding of various Microprocessor/Microcontroller features, their operations and
appropriate use of relevant development tools (C2-PLO1)

Q1. Please respond to the following queries:

a. What is the difference between a microcontroller and a microprocessor? 1

The conventional understanding of a microprocessor is that of an IC that can understand a


set of instructions based on it’s ISA. It can read a program and execute it one instruction at
a time. On the other hand, a microcontroller is a system on a chip (SoC). It is a combination
of a microprocessor, main memory, internal clock, program memory, ADCs, communication
interfaces (UART, SPI, I2C etc.) built on a single IC. Typically, the processing (MIPS)
capabilities and operating frequencies of processors embedded in a microcontroller are much
lower than a stand-alone microprocessors

b. How does the .DB directive slow down programs running on the ATMega328p? 1

The .DB directive is an assembler directive, which has absolutely no effect on the speed of
any program running on the ATMega328p

c. Illustrate the different types and sub-categories of memories in the ATMega328p. Furthermore, indicate 3
the commands used to transfer data between the general-purpose registers and main memory, IO registers,
stack and program memory with relevant arrows
COMSATS University Islamabad
Sessional-1 Examination Booklet
 
 
 
CLO2: Perform basic tasks with Microprocessors/Microcontrollers and interface digital devices using C/Assembly
language (C3-PLO2)

Q2. Please write an assembly language program that keeps a count of the number of times an ATMega16 5
controller is booted. Make sure that the designated space (where the count will be stored) is 0 the first time the
program boots.
.INCLUDE “M32DEF.INC”
.ESEG ; refer to the EEPROM location
.ORG 0x0000
COUNTER:
.DB 0x00 ; make sure that the value is 0 on the first boot

.CSEG
.ORG 0x0000

OUT EEARH, HIGH(COUNTER); load address on EEAR(H&L)


OUT EEARL, LOW(COUNTER)

LOAD_EEPROM:
SBIC EECR, EEWE ; or SBIC EECR, 1 to check Write Enable
RJMP LOAD_EEPROM
SBI EECR, EERE ; or SBI EECR, 0 for Read Enable

IN R20, EEDR
INC R20
OUT EEDR, R20

STORE_EEPROM:
SBIC EECR, EEWE ;or SBIC EECR, 1 to check Write Enable
RJMP STORE_EEPROM
SBI EECR, EEMWE ;or SBI EECR, 2 for Master Write Enable
SBI EECR, EEWE ;or SBI EECR, 1 for Write Enable




; whatever the rest of the program is doing

S-ar putea să vă placă și