Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Handling data from an A/D converter (serial device)

Solved!
Go to solution

Hello,

 

after a lot of searching and reading - I finally have to ask a beginner's question.  😉

 

How can I handle the collected data converted from (String) HEX to decimals in the

example "Advanced Serial Write and Read.vi" to be displayed in a plot or stored in

a table?

 

Here's the setup:

I have a very fast 10MS/s A/D converter, which is controlled by a virtual COM port.

For initializing and triggering, the commands are send as Strings followed by a <CR>.

The data is immediately stored on an onboard FIFO memory with a 4096 sample

size. Data is transmitted as HEX strings with a maximum of FFF (which equals 1 V)

and a minimum of 000 (which equals 0 V).

 

Communication with the converter works fine. The data is picked up from the FIFO

with a while loop (running 4096 times) and the single data values seem to be okay.

But now I have the problem of "combining" them to a dataset that can be displayed

or stored for later handling...

 

 

Please give me a hint!

 

 

Sincerely

Christian

Message Edited by fumic on 07-09-2009 09:17 AM
0 Kudos
Message 1 of 12
(5,175 Views)

Hi Christian,

you can build an array and store it in a shift register, which you can create on your while loop. You can also write your data into a chart.

You can read the written data from the chart with a property "history" node (max size is history length).

 

Mike

Message Edited by MikeS81 on 07-09-2009 11:26 PM
0 Kudos
Message 2 of 12
(5,157 Views)

Hi Mike,

 

thanks for your answer. - I tried to set up a shift register and an array ...

 

My idea was to first create an empty array (filled with Zeroes) in the first write loop,

because it only runs once.

Then I want to replace the array's indices with the sample values when they are read

by the second loop, which runs for every sample.

In the third step, I want to display the data in a diagram.

 

The draft I made is ... not quite working as expected! Smiley Very Happy

 

Could you please help me with that?

 

 

Christian

0 Kudos
Message 3 of 12
(5,142 Views)
Solution
Accepted by topic author crickert

Hi Christian,

you don't need the for loop. Create the shift register on your while loop. See the attached image.

 

Mike

Message 4 of 12
(5,121 Views)

Hi Mike,

 

now it's working! Smiley Happy

 

But only when I initialized the array outside of the while loop,

my data table / plot will be filled with data.

 

The opposite is true when i do the initialization within the

true case... although I would completely agree to that solution

too.

 

I am very happy about your great help!!

 

 

(Happy)

Christian

0 Kudos
Message 5 of 12
(5,115 Views)

Hi Christian,

can you show your example where you only initialize the array inside the loop. It should also work. You have to directly wire the array in the false case.

 

Mike

0 Kudos
Message 6 of 12
(5,097 Views)

Attached is an example of the initialization in the "false" case:

all values but the last one are zero (connected to a data table).

That makes sense if the array is repeatedly initialized...

 

When I initialize in the same case frame - but for the boolean "true",

then no values are recorded at all ... maybe autoindexing is missing?

 

 

Christian

0 Kudos
Message 7 of 12
(5,078 Views)

Hi Christian,

you should also use the left part of the shiftregister, because there are your "old" values. See the attached picture.

 

Mike

0 Kudos
Message 8 of 12
(5,074 Views)

Hi! 🙂

 

Still, only the last value is correct..

I noticed, that the tunnel on the right hand side is white inside -

unlike the one on the left hand side (see attachment).

 

Is this important?

 

 

 

0 Kudos
Message 9 of 12
(5,052 Views)

Hi Christian,

it's still wrong in your image. Initialize the array in the true case (=0) and directly wire the left part of the shiftregister to the open tunnel on the right side of the case structure. If you really do this, then you don't have a dot on the tunnel of the right side.

 

Mike

0 Kudos
Message 10 of 12
(5,050 Views)