how to calculate CPU usage of a 87c51 microcontroller

Thread Starter

phaneesh.siva

Joined Sep 2, 2010
3
hi all,
iam using Intel 87c51fb microcontroller in one of my projects. i would like to know the usage of CPU(% of cpu usage), please help me how to calculate the cpu usage of this microcontroller.
 

t06afre

Joined May 11, 2009
5,934
hi all,
iam using Intel 87c51fb microcontroller in one of my projects. i would like to know the usage of CPU(% of cpu usage), please help me how to calculate the cpu usage of this microcontroller.
The CPU usage will be 100% always. What is more important is timing. Like say if you use timer to generate timed intervals with an interrupt service routine. Then it is very important that the MCU is able to finish all work in the service routine and return from it (preferably with a good margin) before a new interrupt occurs. Most development enviroment will be able to help you in doing this kind of calculation
 

Papabravo

Joined Feb 24, 2006
21,159
You need to be more specific about the conditions. If the algorithm running on the 87C51 puts the processor to SLEEP then the utilization is no longer 100%. Keeping track of real time while the processor is asleep can be either precise or can be an educated guess. How important is the actual number?
 

DonQ

Joined May 6, 2009
321
With what I do, it's more important to determine how much time is spent in interrupt routines. I just set a bit on entry, and clear it on exit. Then it is a simple matter to see this on a scope. Even an averaging voltmeter can give you a good estimate of percent time spent in the routine.

Specific routines can be done the same way.

Or if you are running some sort of time-share system, and have a lowest priority "idle" process, just toggle the bit quickly there, when it is not toggling, you know you are somewhere else, doing real work.

If you are worried about the overhead of the time spend toggling the bit, or being off by a half-cycle using the "idle" toggle, or not counting the interrupt latency, then you don't need to know anything else. If you're worried about timing at this level, you are certainly desperately underpowered.
 

Thread Starter

phaneesh.siva

Joined Sep 2, 2010
3
You need to be more specific about the conditions. If the algorithm running on the 87C51 puts the processor to SLEEP then the utilization is no longer 100%. Keeping track of real time while the processor is asleep can be either precise or can be an educated guess. How important is the actual number?

in my application i am using three interrupts, highest priority is given to serial interrupt. timer0 and int0 are of equal priority. int0 interrupt will be coming for every 20 msec and sytem is required to respond to the interrupt within 3 msc, this is the only task which is taking about timing and all other things are not time critical. timer0 is used to send some data to external device through serial port.
 
Top