LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

Blackfin RTC fractional second value

Is there a way to get the fractional component of the second value from the RTC on the Blackfin?  If you look at the "BF RTC Get DateTime.vi" the fractional second is set to 0.  I need to get this value, or at least resolution sub-second.  Is there a way to do this?
0 Kudos
Message 1 of 5
(6,944 Views)

Eric,

 

Look in labview\Targets\ADI\Embedded\vdk\common\lv_device\rtc.c. That VI is calling the System Services function adi_rtc_GetDateTime, which returns the data from the RTC_STAT register. Here is the format of that register

 

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17      16
             Day Counter (0–32767)                Hour (cont’d)


15 14 13 12              11 10   9   8  7   6     5   4  3   2   1     0
Hour (0–23)              Minutes (0–59)           Seconds (0–59)

 

The granularity offered by that register is to the second. As a workaround, you could use the Tick Count function to get sub-second time resolution.

--
Michael P
National Instruments
0 Kudos
Message 2 of 5
(6,941 Views)

That's exactly what I'm going to try.  I'm going to use the millisecond timer in conjunction with the second interrupt function from the Blackfin to "reset" the sub-second value to 0.  I'll post the VI once I have it done.

 

Thanks Michael for the quick response!!

 

Eric

0 Kudos
Message 3 of 5
(6,939 Views)

Michael,

 

I think I may have found a bug in the embedded implementation of the  "Date/Time To Seconds" function.  This is the concept I have for the fractional second portion of the RTC timestamp:

 

1)  Set the RTC Second Callback.  This will trip every second of the RTC.  In the callback, set a global variable to the current ms timer value.

2)  When retrieving the RTC, use difference between the Global variable set in the callback to the current value of the ms timer.  This will give you the current fractional second needed in the RTC.

3)  Bundle the fractional second into the timestamp.

 

The callback works, the calculations all work, where it fails is when I convert the  date/time cluster into a timestamp using the "Date/Time to Seconds" function.  This seems to throw away the fractional seconds.

 

I have included a little example of what I'm seeing.
0 Kudos
Message 4 of 5
(6,930 Views)

Hey Eatherton,

 

I will work with Michael on this, to re-create the issue.

 

Will get back to you soon.

Aashish M
CEO
TransferFi
www.transferfi.com
0 Kudos
Message 5 of 5
(6,903 Views)