Discussion in "8051 Discussion Forum" started by    kirangowle    Jan 1, 2011.
Sat Jan 01 2011, 09:46 AM
#1
Hi,

I m finding difficulty in explaining the function of interrupts in 8051, How shall i demonstrate them the use of interrupt, advantage, efficiently etc.
Do you have any ideas or programs with interrupt and with out interrupts to show how interrupt efficiently works.
Sat Jan 01 2011, 10:51 AM
#2
hi kirangowle

How shall i demonstrate them the use of interrupt, advantage, efficiently etc.


interrupt is the most important part of controller any controller without interrupt is nothing interrupt make the machine most useful
basic purpose of interrupts are multitasking
there are 6 interrupt sources in 8051
1) reset interrupt
2) external interrupt 0
3) timer 0 interrupt
4) external interrupt 1
5) timer 0 interrupt
6) serial interrupt
first interrupt is controlled by hardware software can't control it
if u connect the pin9 RST to Vcc for a while then controller will reset
other 5 interrupts are controlled by software
by default its priority is in the same way as i write above
u can changed it by using IP (Interrupt Priority) register
interrupts can be enabled by using IE(Interrupt Enable) register
let say u nned a application in which u need 7-segment multiplexing with serial communication then if u use polling method then in one time u can do one job only
but in interrupt u can do now two jobs
if u check the RI flag in serial port then u has to wait on a line while(RI==0);
but in interrupt when data come in SBUF an interrupt generate and control goes to interrupt function so we not need to check the flag and wait on a line

now let say u want 7-seg multiplexing on any port u can use timer interrupts set the timer interval and mode and run it when it overflow it raise the flag high and interrupt occur in interrupt function u can refresh ur display
if u want to count specific no of pulses using timer as a counter then u also can do that using timer interrupt too configure that as a counter just

external interrupt0 and 1 uses to check is some one press a key or not or any sensor give low output or not
lt say u make a digital clock and u want to set its time u can use push button on interrupt pin that is P3.2 and P3.3 as this pin goes low interrupt occur and there u can set ur clock time
interrupt is an emergency case it is just like an ambulance that has permission to break the laws of signals in case of emergency
controller leave the main function when any interrupt occur and go to the relevant interrupt function after that it come back to main so in this way controller can do multitasking that is useful thing when ur doing coding
in fact interrupt is the best way of coding

Do you have any ideas or programs with interrupt and with out interrupts to show how interrupt efficiently works.


let say we discuss serial interrupt only here basic idea is same for all type of interrupts
without interrupt in c
#include <reg51.h>
void main (void)
{
unsigned char a;
SCON=0X50;    //9600 bps @ 11.0592MHZ 
TMOD=0X20;
TH1=0XFD;
TL1=0XFD;
TR1=1;
while(1)
{
while(RI==0);  // wait here to raise the flag
a=SBUF;
RI=0;
// other functions are called here
conv();
read();
display();
;
;
;
;
}
}


using interrupt in c
#include <reg51.h>
unsigned char a;
void serial (void) interrupt 4
{
if(RI==1)
{
a=SBUF;
;
;
;
RI=0;
}
else
{
TI=0;
}

}

void main (void)
{
SCON=0X50;    //9600 bps @ 11.0592MHZ 
TMOD=0X20;
TH1=0XFD;
TL1=0XFD;
TR1=1;
IE=0X90;   //enable global interrupt along with  serial
while(1)
{
conv();
read();
display();
;
;
;
;
}
}
Sat Jan 01 2011, 11:37 AM
#3
Hi Mojaka,

Thanks, Very nicely stated about the interupts.
Sat Jan 01 2011, 01:52 PM
#4
Good explanation majoka... write your own book.... I will do publicity for you
Sat Jan 01 2011, 04:32 PM
#5
@ kirangowle
welcome dear
@ coolmirza143
i want to write a book in which practical interfacing is described
not a theory practical based
Mon Jan 03 2011, 05:07 AM
#6
Hi mojaka,

Practical interfacing means ADC, 7 segment, RTC etc..
Do it for all the interfacing should be on same board, along with the programmer, There is huge demand in collages as well as corporate world also to train the freshers.
Mon Jan 03 2011, 05:55 AM
#7
hi kirangowle

Practical interfacing means ADC, 7 segment, RTC etc..


yes ur r right adc ,RTC ,steeper, servo,lcds,keypads,eeproms,pc key board ..... and many more

Do it for all the interfacing should be on same board, along with the programmer, There is huge demand in collages as well as corporate world also to train the freshers.


yes all can be done on same board
but it need sources , time and many more its in fact a team work
Mon Jan 03 2011, 06:27 AM
#8


hi kirangowle

Practical interfacing means ADC, 7 segment, RTC etc..


yes ur r right adc ,RTC ,steeper, servo,lcds,keypads,eeproms,pc key board ..... and many more

Do it for all the interfacing should be on same board, along with the programmer, There is huge demand in collages as well as corporate world also to train the freshers.


yes all can be done on same board
but it need sources , time and many more its in fact a team work

majoka



Majoka never feel alone... i am with you start your work i will help you as much i could....


off topic:

I am visiting Islamabad in next week will come in sector H-8 and G-4 in AIOU and HEC offices.... hope to meet you there...
Mon Jan 03 2011, 07:00 AM
#9
thank u coolmirza143
Mon Jan 03 2011, 07:04 AM
#10
you are welcome my friend...

Get Social

Information

Powered by e107 Forum System

Conversation

Sun Oct 13 2019, 02:02 AM
Aline Hutchinson
Hey there,
ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html

Downloads

Comments

ilylily07
Tue Oct 15 2019, 04:32 PM
hientran123
Tue Oct 15 2019, 02:27 AM
Sat Oct 05 2019, 02:38 PM
zexalo
Thu Oct 03 2019, 09:53 AM
thanhle12345
Thu Oct 03 2019, 07:37 AM
ramon_vsc
Fri Sep 20 2019, 04:53 PM
youssoufba
Thu Sep 19 2019, 11:57 AM
Taiphan000
Tue Sep 17 2019, 04:21 AM

Online

Guests: 46, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38097
Newest member: ilylily07
Forum Activity
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:09 PM
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:02 PM
sir, when i on display ,sometime 3rd display is no...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 02:53 PM
sir, when i on display ,sometime 3rd display is no...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 20 2019, 12:21 AM
Your code seems okay on my simulationTry my code o...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 20 2019, 12:21 AM
Your code seems okay on my simulationTry my code o...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:13 PM
please find video attachment. 3rd & 4th displa...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:05 PM
sir, 3rd and 4th dot matrix display flickering, ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Oct 18 2019, 09:18 PM
Hopefully you understand some of the program.Which...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Thu Oct 17 2019, 09:38 PM
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Oct 17 2019, 08:35 PM
Do you understand how this code works?If so, addin...