0
\$\begingroup\$

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?

Greenonline
2,1699 gold badges27 silver badges41 bronze badges
asked Apr 17, 2019 at 10:53
\$\endgroup\$
4
  • \$\begingroup\$ Well there is a bit in EX. interrupt register which you can set/reset to decide the edge \$\endgroup\$ Commented Apr 17, 2019 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\$ Commented Apr 17, 2019 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\$ Commented Apr 17, 2019 at 12:47
  • \$\begingroup\$ Not IE SFR. Thats only for enabling. For each external interrupt there are dedicated register. Did you find that ? \$\endgroup\$ Commented Apr 17, 2019 at 12:54

1 Answer 1

1
\$\begingroup\$

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.

answered Apr 17, 2019 at 12:44
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.