- This topic has 1 reply, 2 voices, and was last updated 12 years, 10 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › ASM software interrupt
First of all I want to say hello to all the member here
I am trying to learn more ASM on my own cause I can’t get any good help from professors in my school.
I have one problem I need to use interrupt in my newest program but I don’t know how to use it cause no-one show us how does interrupt looks like in source code… We have been only learning theory…
Pls tell me how xactly we use interrrupts
interrupts are used when we need to perform a special task during regular task. the full attention of controller is removed from regular task to an important task until this important task is performed.
for example a controller is busy in blinking led on a port0. at Pin 1.0 a buzzer is connected. and a switch is connected to int0 pin. ur task is to on the buzzer when u want. if u use polling u have to monitor P3.2 continuously during led blinking process and this will consume ur 24 clock cycle in each poll. this is not efficient programming . if u use interrupt concept there is no need to monitor the pin P3.2.
example code-
ORG 0000H
LJMP MAIN;
ORG 0003H // int0 isr address
SETB P1.0; // buzzer on when interrupt occur
RETI; // return interrupt
ORG 0030H
MAIN: SETB TCON.0; // int0 an edge trigger interrupt
MOV IE,#81H; // enable harwre interrupt int0
HERE: CPL P0; // led bilinking
ACALL delay;
SJMP HERE;
Delay: // generate a delay subroutine
END