LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to implement only "if statement" using case structure

I am reading a can message which has the data regarding motor voltage along with other messages. I am sorting the messages by comparing the 3rd byte. when there is a match I take the 4th byte which is my motor voltage and display it on the screen. For this I am using a case structure. The problem I am having is when ever there is no match for my motor voltage message the "false case strucutre" is executed and the value in the motor voltage indicator is erased. I kept the Indicator inside my "true case strucutre" this has'nt worked. Then I took the Indicator and kept it outside the case structure making the true strucutre as my default this also didnot work. Can anyone tell me how to retain the true value fro
m my previous case structure untill another value from the true case structure is fed to the indicator.
0 Kudos
Message 1 of 4
(2,800 Views)
Create a local variable of the indicator, wire it to the indicator itself when the false case is executed (in your case when there is no match). The indicator must be outside the case structure.

-Joe
0 Kudos
Message 2 of 4
(2,800 Views)
Thanks buddy, It just worked the way I want.
0 Kudos
Message 3 of 4
(2,800 Views)
I think something strange is going on here. Placing the indicators in the True case and not writing to them when you do not have a match should leave the last value written displayed. I do this all the time and have never had this problem.

I dropped a new meter and connected it to the same place inside the true case right beside the original meter, and it holds the value while the original goes back to zero. I even copied the original meter and it works as it should.

Try deleting your indicators and dropping new ones to see if that fixes the problem.
Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 4 of 4
(2,800 Views)