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– Mitu Raj2019年04月17日 11:02:36 +00:00Commented 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\$Deepak Yadav– Deepak Yadav2019年04月17日 12:11:55 +00:00Commented 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\$Mitu Raj– Mitu Raj2019年04月17日 12:47:45 +00:00Commented 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\$Mitu Raj– Mitu Raj2019年04月17日 12:54:26 +00:00Commented Apr 17, 2019 at 12:54
1 Answer 1
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.
Explore related questions
See similar questions with these tags.