01-12-2017 11:02 AM
I want to save the values for the voltages that I read from a microcontroller to an array in labview. I have attached the VI. My VI basically keeps updating the values at index 0. It does not store the values in different indices. For ex: I want to store values in this order:
a[0] = 3.4
a[1] = 3.2
a[2] = 2.8
a[99] = 4.3
Those are just random values I selected but hopefully I was clear enough.
01-12-2017 12:17 PM
No surprice since you are not using any code that allows you to store or retain your values.
You can, for instance, use a shift register and the Build Array vi.
But do check out the free material, especially this part:
https://www.ni.com/getting-started/labview-basics/shift-registers
I suggest you might benefit from learning a bit more of the Labview basics.
01-12-2017 12:38 PM
Even when I put a string indicator on the Read pallete the values keep on updating instead of showing all the values at once
01-12-2017 01:00 PM
As perhult stated early you need to add the value to an existing array every loop and then display the array.
You should also look into learning labview, but here i added the functionality for you.
01-12-2017 01:04 PM
Thanks! I am learning about shift registers right now
01-12-2017 02:38 PM
Get rid of the VISA Open that is in the loop. You don't need it. It is effectively happening when you configure the serial port. And doing it repeatedly in the loop will either do nothing, or just confuse the serial port.
01-12-2017 02:51 PM
Also the values stop after around the 50th one. I wanted to store 100 values but it just stops after 50-53 values?
01-12-2017 02:56 PM
@engineerbeginner wrote:
Also the values stop after around the 50th one. I wanted to store 100 values but it just stops after 50-53 values?
Obviously you have made some changes to your code. We need information!
What does you vi look like now? (give us a snippet!) What is the device on the other end? What is a typical recieved string?
01-12-2017 03:13 PM
i am sending data using printf functions from ccs complier. I did edit a few things to my VI. I added in another read since I have two printf statements. I also initialized the array to 102 because I want the very first index to have that value. Everything else seems to work just fine except for the fact that i can't seem to store 100 values in the array.
01-12-2017 03:53 PM
There is nothing in that code that would prevent the arry from growing until the CPU runs out of memory.
When you say "it just stops after 50-53 values" what happens exactly.
I've made a modified version that does some better error handling and may help debug that issue- try that