??? 08/13/05 12:31 Read: times |
#99331 - Interrupt question |
Hello Forum,
In my project I am struggling with external interrupt 0. I am using AT89S8252 microcontroller, which is controlling a DC and AC motor. I want to use external interrupt 0 as emergency stop button. As in emergency stop, I want microcontroller to stop all operations in process and go back to start of program. As I switch on power to microcontroller, the code works fine and the external interrupt works fine as well. but as the program goes back to start and runs again , then the external interrupt does not work. Means external interrupt works only once after switching on power.In order to make it work again I have to siwtch off power and switch on again (which I understand resets the program) But why is that ?? I have read the tutorial and previous threads on website but could not figure out the solution. I am making the program to jump to start within interrupt routine, is this the problem? Below is the code Initialisation of Interrupt START2: MOV SP,#31H MOV IE,#85H CLR IT0 Interrupt Service Routine is as below EXTERNAL_INTERRUPT: MOV P0,#0FFH MOV P1,#0FFH MOV P3,#4FH CALL CLEAR_LCD CALL EMERGENCY_STOP_TEXT LJMP MAIN RETI All suggestions would be appreciated Regards James |