Discussion in "8051 Discussion Forum" started by    bobster    Nov 5, 2015.
Thu Nov 05 2015, 06:39 PM
Hi all,

I am using an atmel 89c5131 microcontroller with a 24mhz crystal running with X2 enabled (system clock only, not peripheral clock).

I have an external source generating a square wave which is fed into an external interrupt. The external int has highest priority and there is another timer (60 millisec) which has a lower priority. Its configured to vector on the falling edge.

The idea being the external interrupt fires and increments a counter each interrupt. The 60msec timer interrupt then fires, reads the counter and resets it. Then the process starts again.

The external frequency can range from 1khz to 800khz.

It all works fine up until the external interrupt frequency reaches 500khz. It then hangs the processor and it stops firing the timer interrupt.

If i disable X2 mode on the 24mhz crystal then i can only go to 250khz on the external interrupt.

if i fit a 48mhz crystal (and have to disable X2) then the timer interrupts run faster (i wasn't running those in X2 mode with the 24mhz), but when the external frequency reaches 500khz it hangs again.

if the max speed that the external int can process interrupts is 1/24 crystal speed then this would give a max of 1mhz with a 24mhz crystal, but i am seeing 500khz.

Google results seem to be saying that 500khz is the limit for a 12mhz crystal so i cant work out why i am seeing this limitation with 24mhz. I need to be able to process up to about 800khz external interrupt speeds.

thanks in advance for any help, its driving me mad!
Fri Nov 06 2015, 01:12 AM
The key thing is the length of the interrupt code.

As I see it, you can process 4 million instruction cycles per second
using a 24MHz crystal.
At 500KHz that's only 8 cycles, including interrupt overheads,
You can't do much with that !

Check your compiler listings, see what code is being generated
and add up the instruction cycles.
Note that there may be more than one instruction cycle per instruction.
Basically there is not enough time for code to complete.

Get Social


Powered by e107 Forum System


Mon Apr 12 2021, 11:54 AM
Joe N
I have recently launched my own site, and I am looking to provide value for you for free, by giving away 26 professional level blog post templates (worth $297).
Mon Apr 12 2021, 09:24 AM
Hey, I think your site might be having browser compatibility issues. When I look at your website in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, very good blog! https://onanadiete.ru/alpha-numeric-reasoning-questions-and-answers-pdf.pdf alpha numeric reasoning questions and answers pdf alpha numeric reasoning questions and answers pdf



Thu Jun 25 2020, 03:46 PM
Mon Jun 22 2020, 03:03 PM
Tue Jun 16 2020, 05:10 PM
Sat Jun 13 2020, 09:43 PM
Thu May 21 2020, 12:44 PM
Thu May 21 2020, 01:28 AM
Wed May 20 2020, 07:05 PM
Wed May 20 2020, 11:52 AM


Guests: 101, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38215
Newest member: Mirza123