08-07-2018 12:21 PM
Hello everyone
i want to save data and time of each data come from serial port in a array same time that data saving in another array.
can anyone help me?
thanks
08-07-2018 12:24 PM
Do you know how to work with arrays?
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
08-07-2018 12:37 PM
yes i know.
i just need to save date and time of each data save in array
08-07-2018 01:19 PM
Then where are you stuck? Attach a VI that shows your attempt. You should be able to easily build your time information into the array. If it is a timestamp, you may have to convert it to a double, assuming the rest of the array is a double.
08-07-2018 09:42 PM
As you see in my VI, I collecting data that come from serial port and filter them as I want. Then for example if data was equal (5), it will record it. Now I want to see date and time for recording time that when next time value (5) come from serial port, I can see duration between first (5) and second (5).
08-07-2018 10:43 PM
Let's clean up many of the problems you have with your VI first.
1. Do you really want to configure the serial port every iteration of the while loop? The Serial Configure should be before the loop. You don't need the VISA Open at all.
2. Bytes at Port is the wrong thing to use 99% of the time. I'm going to assume (since the serial configure is set for a termination character) that the string coming in is some digits and a linefeed character. Take advantage of that and set the bytes to read at VISA Read to be a larger number.
3. Converting from an array to a cluster then unbundling is pure Rube Goldberg. Use Index Array to get the first and second elements of the array. (Index Array is expandable by dragging the bottom border downwards to give multiple outputs.)
4. You have a lot of redundant code where you make numerous comparisons and drive numerous case structures. Wire your integer to a case structure and have a separate case for each of 1, 2, 3, 4, 5, Anything in the true case for the respective comparison will just go into the correct case.
5. Your case structures don't do anything productive. You are just appending Trues to then end of the array. And the array to cluster unbundle dance mentioned earlier just yields the same 1st and 2nd true in the indicators.
6. I see clock functions in each case, but you aren't trying to do anything with them. It seems to me that value is what you want to store in the feedback node, and you'd take the difference in time between the current value and previous time and append that into an array.
I would recommend you learn more about LabVIEW from here. How to Learn LV
08-08-2018 12:47 PM
Thanks for your complete answer. i will work on it one by one and then let you know result.
thanks again