Freecntr32 : GetTimeReal function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Freecntr32 : GetTimeReal function

562 Views
kennyl
Contributor I

I'm a newbie with Eclipse and Kinetis Design Tool 3.0.0; and have recently been trying out the Freecntr32 function FC321_GetTimeReal(). I notice that the pop-up instructions indicate that this function returns the time in units of seconds. However, I found that it is returning the number of clock counts instead. So it's not returning the time in units of seconds. On the other hand, the FC321_GetTimeSec() function is returning the time in units of seconds. So, FC321_GetTimeReal is giving me a value between 0 and 65535 (and keeps cycling), while FC321_GetTimeSec is really giving the number of seconds. Are the pop-up instructions erroneous for GetTimeReal? I am using the KDS 3.0.0 with the KL25Z board (with Processor Expert assistance) at the moment. Thanks all.

Labels (1)
0 Kudos
2 Replies

373 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

hello,

the return value of GetTimeReal() is Error code

  - Error code, possible codes:

**                           ERR_OK - OK

**                           ERR_SPEED - This device does not work in

**                           the active speed mode

**                           ERR_OVERFLOW - Software counter overflow

**                           ERR_MATH - Overflow during evaluation

the Time in seconds is the parameter of GetTimeReal, it must be set as float type, make sure your project also support float.

does this answer your question?

pastedImage_0.png
Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

373 Views
kennyl
Contributor I

Hi Zhang Jun! Thanks for your kind response. I had set the time variable to be float type. This is what I always had. I'm reporting that when I use the GetTimeReal function, the returned value turns out to be values ranging between 0 and 65535 (ie unsigned 16 bit value). This means if I allow the program to cycle continuously, I get values that are like 135, 1000, 3000 etc etc... 64300, then back to 56....100, 500, 1556 etc etc ... 65500.... then the cycle repeats again.

But when I change the the function to GetTimeSec, the returned values are 0,0,0,0,0,0...etc.....1,1,1,1,1 etc ,2,2,2,2,2 etc etc....3,3,3,3,3...etc etc ...... where the values are observed to change after each 1 second. This is consistent with 1 second changes.

It appears that the documented description for returned value of the GetTimeReal function is incorrect. Rather than returning the number of seconds, it is actually returning the number of clock counts.

Thanks again Zhang Jun.

Kenny

0 Kudos