Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

interrupt not working properly p89v51rd2

Status
Not open for further replies.

cheenu02

Junior Member level 3
Joined
Jun 16, 2011
Messages
31
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,500
hi,
I am using external interrupt 1 in p89v51rd2 for operating a pump through the dispenser switch.I connect the dispenser switch with PIN 3.3 .when I press the dispenser switch the pump doesn't get turn on sometimes.Please check My ISR routine below

void timer_init()
{
TMOD |= 0x01; //Intialize Timer 0
TL0 = 0xff;
TH0 = 0xFf;
// IEN0=0x87; // Enable Timer 0 interrupt
TR0 = 1; //Start Timer 0
ET0 = 1;
}

void desable_timer0()
{
ET0 = 0; // Desable timer0 interrupt
TR0 = 0; // Stop Timer 0
}

//ISR to check Dispenser switch is pressed
void check_dispensor_sw() interrupt 2
{
if (disp_solenoid == 0)
{
timer_init(); // Enable timer for checking disp_solenoid state

pump = 1;

}

return;
}

void timer_isr()interrupt 1
{
if (disp_solenoid == 1)
{
desable_timer0();
pump = 0; // Switch off the pump
}
return;
}
 

Post your complete program including "main" routine and state the programming language that you used.

Check the interrupt is enabled and apply correct interrupt triggering mechanism
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top