LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to compare the live data which is coming out of a serial device after every two seconds.

Solved!
Go to solution

Hi, 

 

This is Mohammad. I am new labview user.

 

I am working on a serially communicated instrument. In every two seconds I coded to get a single data point from the instrument. My problem is I want to compare the current data point with the immediate previous one. How can I compare each time the current data point with the previous one. Can anyone please help me?

 

 

 

Looking forward. 

 

Mohammad 

Message 1 of 10
(4,263 Views)

You can use a 'shift register' in a loop.

The shift register will store the value of the previous iteration, so you may use it with the current iteration.

May I ask what comparison you are doing with the two values?

Cory K
0 Kudos
Message 2 of 10
(4,258 Views)

Hi thanks for the answer. 

 

I understand I am missing something very basic. I am attaching my VI to have a look. I want to compare the data point which is feeding to for loop (Incoming data point at 2 sec time interval). Between two successive data points I want the difference and if the difference is less than 10 the current data will pass the case structure or else it will be divided by 1000 for some unit conversion. Using this code I see the difference always zero (which is obvious) but I want the difference between the current data and its immediate previous one and I dont know how to do that. Also regarding no. of iteration I am not sure what its value should be becasue the data is coming after every two seconds. The updating data I watch through waveform chart.

 

Looking forward.

 

Mohammad 

0 Kudos
Message 3 of 10
(4,249 Views)

Close, but no cigar Smiley Wink

What I meant by using a shift register, was to put the code between the two shift registers.

I attached a modified version of your VI.

Message Edited by Cory K on 06-11-2009 01:57 PM
Cory K
0 Kudos
Message 4 of 10
(4,235 Views)
Solution
Accepted by Islam

If you wanted to graph this data:
Replace the While loop with a For loop.


Then if you wire the data out of the For loop, it will be automatically built into an array.

This array can be passed to a graph/chart if you want.

Cory K
Message 5 of 10
(4,231 Views)

Thanks Clad.

 

Now it is working. I appreciate your help very very much. Now, I may come up with some new problem.

 

 

Mohammad 

0 Kudos
Message 6 of 10
(4,229 Views)

Then please mark Cory's message as the solution to your question rather than your own thank you message.  You can go to the Options menu to the upper right of your message and select Unmark as solution.  Once you've done that you can select whichever of Cory's messages most helped you as the solution.

 

PS,  CLAD is not a name, but the acronym for the Certified LabVIEW Associate Developer.  Anyone who has taken that multiple choice exam and passed is denoted as having a fundamental understanding of LabVIEW programming.

Message 7 of 10
(4,221 Views)
You'll want to thank Cory (CLAD stands for Certified LabVIEW Associate Developer). You should also mark his answer as the solution instead of your thank you. Click on the 'Options' button to change it.
Message 8 of 10
(4,220 Views)
You're welcome.... and LOL
Cory K
0 Kudos
Message 9 of 10
(4,206 Views)
I am cory that you have corrected the solution marked. No actually I am clad that you have.... Ah ok I am glad......:smileyvery-happy:
0 Kudos
Message 10 of 10
(3,944 Views)