FreeCounter Bean, does not return the 32bit counter?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

FreeCounter Bean, does not return the 32bit counter?

2,949 次查看
Raiker
Contributor I
I'm trying to implement a simple freq counter using the following formula: 1/(timeSinceLastPulse)=Freq. (it's a simplified version). For that i thought i could use a Free running counter, and do the math. But when i try to find a method that would give me the value of the counter, i find that the avaiable methods are: GetTick, GetUS, GetMS, GetSec, and etc, not GetValue. Since i'm using 25uS as my resolution and all the above methods return a integer, i don't know how i can get the value of the counter (without resorting to modifying the bean, if i have to i will but i prefer not to). Is there a way for the methods to return a float (i have 32bit float enabled in my project) or to create a method to access the counter?
I just wanted to avoid using an TI1:TimerInterrup with an OnInterrupt handler and my own 32 or 16bit math (since i can't code asm as efficiently yet)
标签 (1)
0 项奖励
回复
1 回复

1,199 次查看
ProcessorExpert
Senior Contributor III

Dear Customer,
From your message it's not clear which CPU family do you use and which
CodeWarrior version. It's also not very clear why you need to get a float.
Anyway, please notice the difference between the FreeCntr8, FreeCntr16, FreeCntr32 and FreeCntr beans.
The FreeCntr8,16,32 is internally counting a periodical interrupts with a period
determined by the property 'Resolution' and allows to return this value as
microseconds, miliseconds etc.
The FreeCntr bean (without a number) is a low-level (platform specific) bean
that uses hardware counter and allows to configure its period (using the property period), reset it and read its value in the native hardware format of the counter register.
best regards
Petr Hradsky
Processor Expert Support Team
UNIS
 

0 项奖励
回复