LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving values as temporary variable as in C, but with no UI controls

Hello Labview world, I am a placement student been thrown into the deep end to design a program that auto calibrates a ADC using labview. Given the option to do this in C and i would not have a problem but labview is different. I have the folloing problem. The ADC has to register to fine tune its output. FCR (gain) and OCR(offset). The adjust the data in the DOR (data output register) of the ADC. I want to set a known voltage on the input of the ADC (say 500mA) and then i will read the output code of the ADC and convert into a voltage in the range of 0 - 5V. I have all the controls for the ADC already programmed. My problem comes when the output code is not equal to the voltage i sent in. for example my first try i got a output code equivalent to 1.13V for a 0.5V input. To adjust the output code i need to read the FCR and OCR registers and then save these to a variable in memory but i do not wish to display them on the front panel as there is no need. i work out the difference between the output and input and divide this by two. I now need to start adjust my first register (FCR default value of 800000 Hex) until i reach the midpoint between the current OP voltage and known IP voltage. I will increment by 100000HEX first (FCR now equal to 900000H) and then read back the new OP voltage. If it has now over shot my midpoint voltage i need to reduce the incremental value and then add this to my first FCR value which i hoped to have saved earlier so that the new value would be 810000H. Then read back the voltage and adjust registers so on so forth until i home in on the midpoint value. once there i will adjust the OCR register in the same way to reach myactual IP voltage. I know this method is crude but it does work and I'm just stuck on how to save temporary variables in labview that i can keep going back to just like having the following in C that i can set when i like : int previousFCR = 0x800000;
int NewFCR;
int IncrementVal;

Sorry about the description being so long but any help u clever people could give me would be a great help!!!
Ta
Howard
0 Kudos
Message 1 of 3
(3,850 Views)
Hello.

To be quite honest, I did not read your problem description in very much detail, because judging from the title of your question, your main interest is not displaying intermediate results while you are calculating something in a loop. If this is the case, I hope this answer helps:

Roughly speaking, a wire is the closest thing there is in LabVIEW to what we call a variable in a text-based language. If you do not connect the wire to any front panel object, then its value is never displayed.

If your program is already working, and the only thing that bothers you is displaying intermediate results, perhaps the simplest thing to do is to make the indicator invisible while you are looping, and make it visible again when you get the final result. You d
o this by right-clicking on the indicator, and selecting Create > Property Node, and writing to the "visible" property (you have to right-click on the property node and select "change to write" and then connect the appropriate boolean value).

If you are still developing the program, and I am right in assumming that you have some kind of loop which stops when the correct value is reached, use shift registers to "pass" the value of a wire (variable) to the next iteration of the loop. Do not connect any indicator to the wire inside the loop, because the indicator will be updated with each iteration of the loop. Instead, place the indicator outside the loop and connect it to the right hand side of the shift register. That way, the indicator takes the value of the wire in the last iteration.

Hope this helps.
0 Kudos
Message 2 of 3
(3,850 Views)
Hi Howard,

I think I understand what your trying to do from your description but I'm slightly struggling to understand exactly how you are trying to do it.

Please could you attach you vi and then I can take a look at it and then I will be in a better position to offer advice.

Best regards,

Peter H
Applications Engineer
National Instruments
0 Kudos
Message 3 of 3
(3,850 Views)