LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

High speed concatenate multiple samples

Hi guys,

I'm working on a biosignal proccessing project, i'm using a TI Analog front-end ADS1294r.

I need acquisition 24-bit data from ADC chip via USB port (CDC) and plot into a graph. Conversation data is 24-bits but data transmitted in bytes, I need concatenate 3 bytes into 32-bits signed number.

i have use Decimate 1 array and Join numbers to concatenate samples, but error occurs when sampling rate is too high, about > 8kS/s. I think processing speed is not enough. Please give me suggestions 🙂

I attached the capture.
Any help will be very grateful for me..

 

0 Kudos
Message 1 of 10
(3,777 Views)

Can you attach a VI containing  a typcal string and expected result (e.g. as a diagram constants).

 

What is the chart history length?

 

Maybe you want to simply queue up the received data and process it asynchronously in a parallel loop.

 

(What's up with all the coercion dots? What with the amplitude&Level that's not doing anything useful?)

 

 

 

0 Kudos
Message 2 of 10
(3,764 Views)

Hi altenbach, thank you for answering.

i have attached my VI. This only a test diagram, and amplitude&Level serves some purpose that I have temporarily removed 🙂

 

Currently I do not have a example string at all, but I can describe the acquisition as follows:

- Microcontroller collects 24-bit samples into a data array

- This data array is transmitted via USB with format:  byte1,1| byte1,2| byte1,3| byte2,1| byte2,2| byte2,3|....

- I want to split each of 3 consecutive bytes and re-create a 32-bit signed number

- Then draw the pattern on graph

 

You're right, i want to queue up the received data, that isn't need to sync but at least the arranging/drawing speed is correspond to the transfer speed.

When transfer speed is too high, the concatenating speed is not meet requirements and graph are sometimes wrong??

Further more, how to process it synchronous as you say?

Thanks!!

 

 

 

 

0 Kudos
Message 3 of 10
(3,725 Views)

I said "asynchronous".

What is the byte order?

Is the termination character correct?

You are trying to read 1000 bytes, shouldn't you read a number that is a integer multiple of three?

0 Kudos
Message 4 of 10
(3,710 Views)

Hi altenbach,

Asynchronously, I mean I was processed asynchronously, so there are better ways to handle synchronization?

 

Data is sent as continuous stream, i use Decimate 1D array to divides the elements into 3 output array. I have use a button on the board to terminate data stream.
 

I really do not know the meaning of the termination character, I consulted another diagram and don't understand this parameters. Do i need disable termination char?, it affects the result?

 

Number 1000 bytes that can be changed while running or before running the program, ofcourse i read a number is a multiple of 3.

 

I'm a newbie in this field, thanks for taking time to answer!

0 Kudos
Message 5 of 10
(3,703 Views)

I use my device to collect a sine signal.

This is 2 captures i have plotted by labview and a C# program (using the same way to queue and concatenate multiple bytes).

When using C# to plot, the signal is correct but slower than the real speed of signal. I want to plot signal in real-time.

Plot using labview have some errors occur beside some correct samples.

 

Download All
0 Kudos
Message 6 of 10
(3,692 Views)

@hmc291 wrote:

I really do not know the meaning of the termination character, I consulted another diagram and don't understand this parameters. Do i need disable termination char?, it affects the result?

 


If the data is sent as a continuous stream of bytes and without termination character, all bets are off, because there is no way to tell the correct framing of the data. For example if you receive the following bytes:

 

b1, b2, b3, b4, b5, b6, ...

 

There is no way to tell if the first correct 24bit value is b1-b2-b3, b2-b3-b4, or b3-b4-b5, etc. How are you planning to sort all this out?

 

0 Kudos
Message 7 of 10
(3,659 Views)

Hi,

I have understand what you mean, I'm really no way to control the byte order.

But, that is only a test program. When i push a button in board, the conversation start, result data is collected : b1, b2, b3, b4 ....

Via USB CDC class, i have sent a 63 bytes data packet. And so on the computer, each time receiving interrupt occurs, I can handle that concatenation of bytes in the ISR.

Indeed such processing in C #, everything is fine.

 

Please carefully see my VI diagram and captures, sometimes graph is correct and sometimes draw wrong.

Does that errors related to wrong arrangement 3 bytes data or termination character??

 

 Can be Decimate 1D array function working wrong with high speed input data?

0 Kudos
Message 8 of 10
(3,643 Views)

Hi hmc291,

 

I took a look at your VI, but am still not entirely sure about what you're doing with your signals here. It says you collect 24-bit samples, which are transmitted as byte1,1| byte1,2| byte1,3| byte2,1| byte2,2| byte2,3|.... then you want to split each of 3 consecutive bytes and recreate a 32-bit signed number. Could you write out how you want byte1,1|byte1,2|... etc to be arranged back into a 32-bit number? What 4 bytes will make up your 32-bit number, in what order?

 

Here's more information on termination charactersTermination characters notify you of the end of a transmission. So if you request a certain response from your device, once that response is done it will send a character such as '\n' so you know that this transmission is done. If your device is sending termination characters after a certain number of bytes, but you're just handling the input as a string where each group of 8 consecutive bits is a value, this would mess up the values you're getting.

 

Do you know that the device is sending back only 24-bit values constantly, with no termination characters? As well, will that data always be coming back in order?

 

Depending on how fast your values are coming in, it's also possible that the processing you're doing is too slow and is causing this issue. In that case, you might want to have one loop that is constantly acquiring and buffering the data, and another loop that will take that string, decimate it, and put it back together for your graph. This type of two-loop architecture that can acquire and process data in parallel is called the Producer/Consumer Design Pattern.

 

I hope this helps!

 

 

Emily C
Applications Engineer
National Instruments
0 Kudos
Message 9 of 10
(3,607 Views)

Hi Emily-C,

After A/D conversion, I receive data in format

          sample 1       |       sample 2       |        sample 3      |.....

byte1 - byte2 - byte3     b1 - b2 - b3              b1 - b2 - b3     ....

 

This data was stored in a byte array and then transmitted to computer

 

Data receive in COM port is String and I just only convert it into byte number (as I know). It mean i just receive data in single byte format, then I must concatenate 3 bytes in order b1-b2-b3.

 

Today, my problem has been solved, cause I was not paying attention to termination character then enabled it as default. When any byte of data has the same value with termination character, it is ignored. That is the real reason.

 

No problem with Decimate 1D array. No problem with high data rate.

 

Thanks Emily-C for suggestion, Producer/Consumer Design Pattern is a useful idea to consult. 

 

 

0 Kudos
Message 10 of 10
(3,597 Views)