LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading problem

I have inherited a test program that uses VISA to read values.  This program has a engineering screen that uses a producer / consumer architecture, with buttons which trigger reading and writing of the VISA values.  The program is very slow to read and write values (I wonder if this is because the lack of waits in the while loops). 

Ideally all of the values would read and write continuously, but I am not going to change the program that much. 

 

The issue is the program will allow the switch tank value (see snippet below) to be switched when it is not safe.  This value should only be switched when two other values are at or close to zero.  

 

I want to disable and grey out the control for this value, but the values need to read numerous times until they are stable to determine if it is safe to enable the control.

This is only active when relay 1-5 or switch tank is pressed:

Mark1349_0-1783000320282.png

 

I am offsite right now, but I am going to insert this while loop with both read values, as shown below.  Will this work? Any comments are welcome.

Mark1349_3-1783002099118.png

 

 

 

0 Kudos
Message 1 of 3
(61 Views)

@Mark1349 wrote:

 

Mark1349_3-1783002099118.png


It is impossible to debug truncated code pictures.

 

Some questions:

  • Are the shift registers initialized? 
  • Why use a value property instead of a local variable? Where is the terminal?
  • You have two identical "code trains", differing only in ai_0 vs ai_1 Why not use an inner FOR loop, autoindexing on an array of two enums. (I assume the subVIs are not reentrant and will not run in parallel anyway).
  • with a loop rate of 10ms and a 10 point history, you are only looking at 100ms worth of data. Is this sufficient?
  • How does this loop fit into the rest of the architecture? When is it called and what happens when it stops?
0 Kudos
Message 2 of 3
(40 Views)

Altenbach,

Thank you for your response. Those are good questions.

 

#1 The shift registers will read the starting value of the analog inputs.  I could start them at some value, but since I am looking for zero, I would need to start them higher than zero, but would not want to delay the slow VI any more than it already is. 

#2 The local variable is located inside the consumer loop with the Ai_0 button.  As I said, I don’t like the fact none of these indicator values are actually updated until their button is pressed.

Mark1349_0-1783016091524.png

 

#3. The subVIs are not reentrant. The intent is to prevent the operation of the Switch Tank control if either the Ai_0 r Ai_1 value is above 0.2.  Once below 0.2, the loop would exit and allow the   switch tank control to be enabled.  Not sure how this could be done with a For loop.

 

#4. You are likely correct, probably need 100ms or more, won’t know until I actually put it in the code.

 

#5.  The intent is to disable and grey out the Switch Tank control shown above, whenever either value is above 0.2.   I think this can be accomplished by inserting this into part of the existing block diagram that is always running when this screen is active, then adding write commands to drop Ai_1 to  zero (Ai_0 will follow as it discharges) if any of the switch controls are activated.  

Mark1349_1-1783016091525.png

 

0 Kudos
Message 3 of 3
(9 Views)