LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquiring 24bit digital samples + Conversion to scalar

Hi All,

 

I have a X series card that is acquiring digital signals.  The data arrives serially, 24b long.  The data is semi-constant (the data arrives at 100KHz, but in 24b pulses that trigger at 1000Hz).

Ideally, I would be able to pull the data in a 2D array 24bits wide, but  I can't seem to do that- I get a single continuous stream.  I need to break that up and convert the 24bits to a scalar value.

 

Anyone know the best way to do this?

0 Kudos
Message 1 of 15
(3,998 Views)

Can you share some of your code, or at least give us a VI that has the datatype as a constant? It's easier for us to visualize what you're trying to do any easier for us to communicate back to you what you should try.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 15
(3,981 Views)

24b conversion.png

0 Kudos
Message 3 of 15
(3,969 Views)

NOTE:  This is an example of what I want to do.  At the speeds I need to sample (100KHz data clock rate, 1KHz word rate), I eat up about 5-6% of my processor.

 

Does anyone know of a more efficient way to handle this?

0 Kudos
Message 4 of 15
(3,928 Views)

Oh. Slow down your loop rate and let the instrument do the high sampling. You're looping as fast as possible and pulling all available samples. Let the samples build up a bit in the buffer before you read them. You can also set you For loop to perform iteration parallelism. Right click to configure this.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 15
(3,923 Views)

Shouldn't your DAQmx Read use the 2D Boolean Array output instead of the U32?  That would elimate the >0 function.

 

The other change I would do is to just read 24 bits at a time from the DAQmx Read instead of multiples of 24.  Then you just do the Boolean Array To Number inside of the FOR loop to convert each channel.  You can then use a queue or User Event to send that data somewhere else for processing and then perform the read again (assuming there is data there in the first place).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 15
(3,920 Views)

@crossrulz wrote:

Shouldn't your DAQmx Read use the 2D Boolean Array output instead of the U32?  That would elimate the >0 function.

 

The other change I would do is to just read 24 bits at a time from the DAQmx Read instead of multiples of 24.  Then you just do the Boolean Array To Number inside of the FOR loop to convert each channel.  You can then use a queue or User Event to send that data somewhere else for processing and then perform the read again (assuming there is data there in the first place).


You can't read multiple samples in as boolean.

 

Why do you suggest only reading 24 samples at a time? Wouldn't reading a larger chunk of data and then processing it in a parallelized For loop be faster?

 

 

This is what I'm proposing:

24 Bytes.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 15
(3,909 Views)

 

@James.M wrote:

Oh. Slow down your loop rate and let the instrument do the high sampling. You're looping as fast as possible and pulling all available samples. Let the samples build up a bit in the buffer before you read them. You can also set you For loop to perform iteration parallelism. Right click to configure this.


Ah, yes.  This was just to show what kind of processing I need to do.  I have an idle state built in, I will adjust that to make it optimal (probably pull data at 10-20Hz).  And I have the two channels split among separate processors; doesn't seem to save much though.

0 Kudos
Message 8 of 15
(3,895 Views)

To clarify... I really would like to know if there is a better algorithm for converting the Nx24 element [U32] to N U32s.  Possibly a matrix operation?

0 Kudos
Message 9 of 15
(3,890 Views)

As far as I know, the actual conversion nodes you're using are the nodes you'll have to go through to do the conversion. It's how you use them that's the difference.

 

Why do you have a Not operator on your boolean array? That's curious.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 10 of 15
(3,882 Views)