01-14-2014 12:48 PM - edited 01-14-2014 12:51 PM
Hello All,
I am fairly new to LabView, I am trying to store and anaylze values from a non-Labview hardware via an rs-232 connection.
I have two devices on COM1 and COM2 ports. COM2 sends a value which I would like to store in an array. COM 2 points will form a somewhat sine wave within a few seconds. I would like to compare these values live to generate: max and min peak values, peak to peak values, and mean (I know LabView has signal icons for this, I'm just not sure how to wire it up).
I have attached the vi.
Thank you for your time and help.
Kelvin R.
Solved! Go to Solution.
01-14-2014 02:39 PM
Sounds like you need to put your read into a loop. That way you continuously read.
What is the format that comes back? Does the box you are reading from use the termination character?
01-14-2014 02:47 PM - edited 01-14-2014 02:49 PM
I am continuosly reading. I wrote to the meter a code function (the meter hast its own code for different functions) that displays the current reading (updated every ~<10ms). The problem I'm having is not being able to store these strings values (which I convert to numbers) to give me a peak to peak reading, or max and min values. I am using "array max and min" but it's always displaying the current reading on both boxes.
I believe I need to use a for loop along with shift registers, but I just don't know how to.
To answer your questions: 1) these string values are convert to integers, 2) no, termination character is not used.
Thanks.
01-14-2014 03:07 PM
kore101 wrote:I believe I need to use a for loop along with shift registers, but I just don't know how to.
01-14-2014 03:13 PM
I am not 100% sure that that is the route I have to go. I have already tried checking out the information tutorials, but I cannot find anything that explains how to properly store values from a serial connection.
01-14-2014 03:22 PM
The serial connection is irrelevant. What you need to learn is something as basic as a while loop and shift register. If you want to do a continuous write and read, then place a while loop around the VISA Writes and VISA Reads. Using the Run Continuous button is wrong. That is a special debug mode. The shift register can be something as simple as a Build Array where you append a new value each iteration.
Eliminate those case statements if you are always going to do something. You have configured the serial ports to terminate the read on a termination character so using the VISA Bytes at Serial Port is wrong.
Before posting again, run the VI so that there is actual data in all controls and indicators. Go to Edit>Make Current Values Default, save the VI, and attach it.