We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am looking for a way to measure CPU usage. We need to know how heavily loaded a Cygnal C8051F020 is and which processes are consuming the most time. Thanks in advance, Bill
Do you have an idle task/loop or something similar that MCU does when it has nothing to do? If you don't, it's going to be kind-of hard to measure how loaded the MCU is because it's always doing something. If you do, you can simply set a port bit before the idle task/loop and clear it when the program exits the idle task/loop. You can use a scope to calculate the duty cycle. Jon
maybe have a timer running, and sample the count on entry to & exit from each task?
Yes there is a main idle loop. Is this what you are suggesting: while forever { set usage bit func1() clear usage bit on entry set usage bit on exit . . funcN() dito } It seems like you could RC filter the output and just hook up a DVM. Bill
Set your DVM to DC and you won't need an RC filter. If you have the extra port bits you can allocate one per task. Will the performance monitor in UV2 help or is most of the CPU time consumed by external interrupts and unsimulated peripherals?