You are on page 1of 6

Microprocessor Systems & Interfacing

EEE-342

Lab # 04 Introduction to Assembly Language Programming of AVR Microcontrollers

Names
SAEED ANWAR FA13-
BCE-051

AHMAD GHAFFAR FA14-BCE-


047
CLASS BCE-6 (EEE-6)

DATE 13-3-2017
SIR IRFANULLAH
o Instructors
Name
In-Lab
Task 1:
Generate a square wave signal of frequency 1 KHz and 40% duty cycle on a digital I/O port pin of
ATmega16.

Task 2:

Write a program to toggle all bits of PORT B every of a second.


POST TASK:
****************************************************** ; BASIC .ASM template file for AVR ;
****************************************************** .include
"C:\VMLAB\include\m16def.inc" ; Define here the variables ; .def temp =r16 ; Define
here Reset and interrupt vectors, if any ;

START:

LDI R16,HIGH(RAMEND) ;load SPH

OUT SPH,R16

LDI R16, LOW(RAMEND) ;load SPL

OUT SPL,R16

LDI R17,0xFF

OUT DDRA,R17

PROGRAM:

SBI PORTA,0

CALL DELAY

CBI PORTA,0

CALL DELAY

SBI PORTA,1 CALL DELAY

CALL DELAY

CBI PORTA,1

CALL DELAY

CALL DELAY

SBI PORTA,2

CALL DELAY

CALL DELAY CALL DELAY

CALL DELAY

CBI PORTA,2

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

SBI PORTA,3

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CBI PORTA,3
CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

CALL DELAY

RJMP PROGRAM

CONCLUSION:

You might also like