Creating a 1-microsecond software timer for the HCS12 processor

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Creating a 1-microsecond software timer for the HCS12 processor

1,776件の閲覧回数
aceshigh
Contributor I
Hello,

I'm using the MC9S12DB12B proceesor for an application, and I need to create some type of software-based timer with a 1-microsecond granularity for measuring how much time my code spends executing each of the tasks over a 1-second interval (for processor usage purposes).

I have a "TaskTimer" variable based on the RTI ISR which runs at a 1 millisecond rate (using an 8 MHz system clock).  I use this variable for determining when to execute each of my tasks in the main task control loop.

However, 1 millisecond is too slow to capture how much time is spent within each individual task.  I'm assuming that a timer with a 1-microsecond granularity would be able to actually capture task execution time.

I was looking at the Enhanced Capture Timer (ECT), but that doesn't seem to be the right application.

Any suggestions on what feature I could use, and on what the most effective way to set it up would be?

Thanks in advance.
ラベル(1)
0 件の賞賛
返信
1 返信

459件の閲覧回数
mculater
Contributor III

Assuming it is just a temporary development requirement, here is one approach that you could use:

If you have some output port pins available, you could assign one pin for each task you wish to monitor.  Then force the relevant output pin high at the beginning of the task, clear it at the end.  Use a 'scope on the pin to measure the duration of the pulse.

Best regards,
Carl Barnes
www.technologicalarts.com
A full line of HC11/HC12/HCS12 hardware.
Evaluate * Educate * Embed

0 件の賞賛
返信