Beruflich Dokumente
Kultur Dokumente
of Instrumentation and
141809001 Control Engineering
Assignment No.7
1) Write a program to generate 1S delay function using Timer Interrupt
method. Use that function in digital clock for to increment seconds count.
Compare the performance of polling method and interrupt method for
digital clock and comment.
Code:
#include <SST89X5XXRD2.H>
sbit pin=P1^0;
int x;
x=20;
void timer1_ISR (void)interrupt 3
{
TF1=0;
pin=~pin;
TL1=0x00;
TH1=0x00;
}
void main()
{
EA=1;
ET1=1;
TMOD=0x10;
for(x=0;x<20;x++)
TL1=0x4B;
TH1=0xFD;
TR1=1;
while(1);
}
1
Dipesh Sinha Dept. of Instrumentation and
141809001 Control Engineering
Code:
2
Dipesh Sinha Dept. of Instrumentation and
141809001 Control Engineering
Output:
3
Dipesh Sinha Dept. of Instrumentation and
141809001 Control Engineering
Code:
4
Dipesh Sinha Dept. of Instrumentation and
141809001 Control Engineering
Output:
a) When no external interrupt is given.
5
Dipesh Sinha Dept. of Instrumentation and
141809001 Control Engineering
4) Consider you are using two or more than two interrupts;you are assigning
high priority to external interrupt_1 than timer_0 interrupt.Create an
application and show the importance of change in priority of the interrupts.
Code:
6
Dipesh Sinha Dept. of Instrumentation and
141809001 Control Engineering
Output:
a) When switch is open then no external interrupt occurs.
7
Dipesh Sinha Dept. of Instrumentation and
141809001 Control Engineering
8
Dipesh Sinha Dept. of Instrumentation and
141809001 Control Engineering
Output:
Proteus Showing Error