0

I'm using assembly language on the 8051FX120 chipset to which a development board is connected. This development board has 8 LEDs, and 8 push buttons.

The push buttons are connected to Port P1.
The LED's are connected to Port P2

-

I am looking to try and utilize interrupts such that when button P1.0 goes high the interrupt is run.

  • Inside the code for the interrupt the code needs to wait for either P1.0 to be push again (and return via RETI to the last program count before the interrupt)

OR

  • if P1.1 is pushed then the program should jump to a label and then run the code from there.

OTHERWISE

  • the interrupt code will continue to loop until either one of these P1 pins goes high.

1 Answer 1

2

It is bad design (and a bad idea) for an ISR (interrupt service routine) to hang around waiting for something else to occur. Typically, an ISR services the interrupt and changes the state of whatever constructs are associated, such as moving received characters to the read buffer, or unblocking a task waiting for the event.

It is generally best that something at application level be waiting to do the kind of logic you describe.

However, before you can react to a button push through an interrupt, the button must be connected somehow to an IRQ (interrupt request input) in the CPU. Since you don't link to the spec for that board, I don't know whether it is or not. Certainly the button can be polled periodically from the main task and all the logic can be derived from what it finds.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.