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.

Newbie in 89C51 interrupt interface need help!!!

Status
Not open for further replies.

semiconductor

Full Member level 4
Joined
Apr 4, 2003
Messages
236
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,296
Activity points
2,735
I’m designing an automatic door using AT89C51 and I’m facing a serious problem that I can’t solve it.

I’m using 2 external interrupt to limit the door. In normal mode, the first limit switch force the interrupt 0 pin to low level and the door is closed. If the sensor detects person coming in, it will open and the the second limit switch is changing its state, interrupt 1 is occurred and the interrupt 1 pin is at low level, the motor is stopped (the interrupt 1 pin is always at low level and only change its state to high when sensor realize that person is out of door (the door is closing)

I intend to config 2 interrupt is falling-edge interrupt driven. But there’s something wrong with this. My program can not start properly! (interrupt 0 / interrupt 1 remain low level after falling-edge occur! Anything wrong with this?

I need you advice to complete my project!!!

Thanks!
 

Seems too complex. Just let the controller read the sensors' status (including door position and people detection) using the external interrupts. followed process to actuate the motor. It is a Finite state machine.
 

Interrupts are used mostly, when you want to react fast to an external event. You can have to options in your application. Either you are polling the ports (INT0, INT1) periodically or you use interrupt. Polling can be used by periodically receiving an interrupt from a timer, or just polling in a cycle in the SW. The later is the case when do main program has nothing to do other than watch the sensors and act accordingly. I see, that your application can be done with the latest and simplest case. Of course, if you want to learn interrupt handling you can do that, but in that case you need to specify more clearly what dio you mean by
interrupt 0 / interrupt 1 remain low level after falling-edge occur
. What do you mean by that? The sensor still forces 0 to the INT0. Is that the case, the only thing is the use an RS flip-flop with SET connected to a port and RESET connected to the sensor. Then from the interrupt hadnler you can SET the INT0 to level 1. Of course the next interrupt occurs only when the sensor has again a falling edge (which means sometimes before should have a rising edge as well).
 

Hi,

Add some additional hardware and save your time.

Add additional FFs to catch and keep external events, then read this FFs periodically with appropriate routine in the main loop and take approprate action in another routine.

89C51 interrupt system is not so fast and good as some newer architectures (ARM).

Use polling with some additional hardware instead pure interrupt driven software solutions.
 

u may detect p1.0 and p1.1 state,not using interrupt
this can be more easily
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top