I am trying to read the speed or number of rotations pulses of a self-made encoder motor.

I am using an AT89C52 microcontroller. It gives external interrupt on rising or falling edge.

How can I attach both rising and falling edge interrupt in AT89C52?

  • \$\begingroup\$ Well there is a bit in EX. interrupt register which you can set/reset to decide the edge \$\endgroup\$ – Mitu Raj Apr 17 '19 at 11:02
  • \$\begingroup\$ you are right IE SFR provides EX1 & EX0 to enable the external interrupt. but the problem is how to call isr ON pin change value of external interrupt pins. \$\endgroup\$ – Deepak Yadav Apr 17 '19 at 12:11
  • \$\begingroup\$ You dont need to call explicitly, it is implicitly called when interrupt edge occurs. You just set the registers and the write the definition of ISR as per the c52 compiler format. \$\endgroup\$ – Mitu Raj Apr 17 '19 at 12:47
  • \$\begingroup\$ Not IE SFR. Thats only for enabling. For each external interrupt there are dedicated register. Did you find that ? \$\endgroup\$ – Mitu Raj Apr 17 '19 at 12:54

There seem to be TWO negative edge triggered external interrupts on that microcontroller. Take your signal, and send it to one interrupt input. Invert the signal, and send it to the other, and enable both interrupts.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.