This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem toggling port pin inside ISR

I am using one of the 8051 external capture ports to generate an interrupt. My code enters and returns from the ISR just fine until I add a line to toggle an unused external port pin. For some reason, it just stops working when that line is in, but when I comment it out, it works fine. Anybody ever encounter similar problems, or have any ideas?

Parents
  • Make sure your code contains a read-modify-write instruction (CPL Px.y,CLR Px.y, SETB Px.y, ANL, ORL, XRL) to toggle your port bit. These instructions read the port latch rather than the logic level of the pin. Other instructions could cause the controller to switch your interrupt input to be an output which would than be stuck at 0.

    HHK

Reply
  • Make sure your code contains a read-modify-write instruction (CPL Px.y,CLR Px.y, SETB Px.y, ANL, ORL, XRL) to toggle your port bit. These instructions read the port latch rather than the logic level of the pin. Other instructions could cause the controller to switch your interrupt input to be an output which would than be stuck at 0.

    HHK

Children
No data