LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

U64 to minutes:seconds:milliseconds.microseconds

Solved!
Go to solution

Hi,

 

How to convert the U64 number to to the format of minutes:seconds:milliseconds.microseconds ?

 

Thanks for help:)

-
Amit
CLAD
0 Kudos
Message 1 of 8
(3,444 Views)

This should be specified in the documentation of the function or library or dll you will use to get this U64 value.

Which is?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 8
(3,426 Views)

Hi Amit,

 

could you please explain the formatting of your U64 value? What data does it contain?

 

Once you did this we can easily solve the problem with you...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 8
(3,424 Views)

Thanks pincpanter and GerdW,

If I use the actual user interface software of the product it shows time in m:s:ms.us format but if I use LabVIEW drivers I get U64 format for the timestamp which I further need to convert to m:s:ms.us

 

The key question for me here, are these ticks to be consider in ms or us ? I am not expert of C or C++.

 

Please see the red marking below.

 

Read SPI (bg_spi_read)

      int bg_spi_read (Beagle   beagle, 
                       u32 *    status, 
                       u64 *    time_sop, 
                       u64 *    time_duration, 
                       u32 *    time_dataoffset, 
                       int      mosi_max_bytes, 
                       u08 *    data_mosi, 
                       int      miso_max_bytes, 
                       u08 *    data_miso);
    

Read data from the SPI port.

Arguments
beagle handle of a Beagle analyzer
status filled with the status bitmask as detailed in Table 11
time_sop filled with the timestamp when the data read begins
time_duration filled with the number of ticks that it took to read the data
time_dataoffset filled with the timestamp when data appeared on the bus
mosi_max_bytes maximum number of MOSI bytes to fill
data_mosi an allocated array of u08 which is filled with the data sent from the master to the slave
miso_max_bytes maximum number of MISO bytes to fill
data_miso an allocated array of u08 which is filled with the data sent from the slave to the master
Return Value

This function returns the number of bytes read or a negative value indicating an error.

Specific Error Codes
None.
Details

The function will block until the requested amount of data is captured, a complete packet with slave select deassertion is observed, or the bus is idle for longer than the timeout interval set. See Section 6.4.1.12 for information on the bg_latency() and bg_timeout() functions which affect the behavior of this function.

The data_mosi array should be allocated at least as large as mosi_max_bytes. The data_miso array should be allocated at least as large as miso_max_bytes.

All of the timing data is measured in ticks of the sample clock.

 

Thanks for help 🙂

-
Amit
CLAD
0 Kudos
Message 4 of 8
(3,397 Views)

So, what is the frequency of the sample clock?

0 Kudos
Message 5 of 8
(3,379 Views)
Solution
Accepted by amitwadje

Once you scale with the sample clock to fractional seconds as DBL, use a FOR loop with a shift register containing a "quotient &remainder", autoindexing on an array of divisors, one for each field to generate an array of parts. After the loop, use "array to spreadsheet string" and ":" as delimiter to format as the desired output.

 

You can likely do it all with blue datatypes, recommended).

Message 6 of 8
(3,372 Views)

The Beagle USB 12 analyzer is locked to a 48 MHz sample rate, thus each count measures 20.83 ns.

https://www.totalphase.com/support/articles/200472426#s6.5

Message 7 of 8
(3,348 Views)

I am using 50MHz frequency for Beagle SPI it can be configured, thus one count tick is 20ns.

Thanks all.

-
Amit
CLAD
0 Kudos
Message 8 of 8
(3,313 Views)