Uploaded by Naveed Khan

MPI LAB NO 11

advertisement
LAB MANUAL
Microprocessors and Microcontrollers
LAB NO. 11
07/10/2021
Interrupts. (open ended lab)
Lab outcomes:
After completing this lab, students will be able to;
• Use internal time interrupts of AVR MC
• Use external interrupts of AVR MC
• Make assembly language programs that perform tasks according to specific conditions
Corresponding CLO and PLO:
CLO-2, PLO-3
Theory:
See course book chapter 11
Procedure: (Write code, attach Screenshots of simulation and pictures of circuit)
Task 1: Take BCD input from 4 pins of a port. Fit a switch on external interrupt 0.
Whenever interrupt occurs, Show BCD number on 7 segment display. When no interrupt
occurs, show 0 on 7 segment display
Code:
/*
* lab 11.c
*
* Created: 16/10/2021 12:45:58 pm
* Author : Moaz Ahmed
*/
#define F CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
int main(void)
{
/* Replace with your application code */
unsigned char NumberArray=0xC0;
DDRK = 0XFF;
DDRD = 0XFE;
DDRB = 0X00;
LAB MANUAL
Microprocessors and Microcontrollers
DDRA = 0X00;
EIMSK = 1<<INT0;
EICRA=1<<ISC00;
while (1)
{
if(PIND & 0b00000001)
{
seo();
}
PORTK=NumberArray;
}
}
ISR(/INT0_vect)
{
unsigned char
NumberArray[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0xC6,0xA1,0x
86,0x8E};
unsigned char a=0;
a=PINA;
PORTK=NumberArray[a];
_delay_ms(40);
}
Output:
Circuit of showing BCD number while pressing the buttons
LAB MANUAL
Microprocessors and Microcontrollers
Circuit of showing BCD without Arduino
Observations:
In this lab we get to know about interrupts and how to to handle interrupts with timer and without
timer. Moreover we get to know about external time interrupts and internal time interrupts. We
were given a task of using 7 segment display and concepts of BCD Addition to solve the interrupts
whenever the button is pressed out will be displayed on 7 segment with respective input on BCD.
LAB MANUAL
Microprocessors and Microcontrollers
Rubrics
Absent
Student is
unable to
follow the
provided
instructions
properly.
The student
can name the
hardware or
simulation
platform, but
unable to
implement
anything
practically or
on the
software
Ungraded
[0]
0.0
Very Poor
[1-20]
1-5
Demonstration
Category
Percentage
Marks
Date
Date
Student has
followed
instructions
to construct
the
fundamental
schematic/
block
diagram/
code/ model
on the
protoboard/
trainer/
simulation
software.
Student has
constructed
the
functional/
working
schematic/
model/ block
diagram/
code, and
have
successfully
executed the
program/ run
circuit on
software
platform
Fair
[41-60]
11- 15
Good
[61-80]
16- 20
Report not
submitted
Plagiarized
content
presented or
incomplete
submission
Requirements
are listed and
experimental
procedure is
presented
Observations
are recorded
along with
detailed
procedure
Appropriate
computations
or numerical
analysis is
performed
Ungraded
[0]
0.0
Very Poor
[1-20]
0.1 - 2
Poor
[21-40]
3-4
Fair
[41-60]
5-6
Good
[61-80]
7-8
Total Marks
Student
perfectly
implemented a
working
model/ logic/
circuit/ block
diagram/ code
and
successfully
executed the
lab objective
in Realtime or
in a
simulation
environment
and produced
the desired
results
Excellent
[81-100]
21 - 25.0
Instructor’s Signature
Total Marks
Laboratory
Reports
Category
Percentage
Marks
Student can
understand
the provided
laboratory
instructions
and familiar
with the lab
environment
(Trainer/
software/
IDE), but
cannot
implement
on the
platform
practically or
on the
software
Poor
[21-40]
6 - 10
Instructor’s Signature
Correctly
drawn
conclusion
with
exact results
and complete
report in all
respects
Excellent
[81-100]
9 - 10
Download