06-14-2012 11:27 AM - edited 06-14-2012 11:27 AM
Dennis: I wrote the program, but I kept debugging until it worked (i.e., recorded data). My knowledge of LabView and VISA is minimal. Your explanation was not adequate, not to a beginner at least. Please save me the demeaning tone, I'm not here for that.
Mark: I think this is the way I will go if I didn't find a solid solution.
06-14-2012 11:58 AM - edited 06-14-2012 12:01 PM
Here ya go, just the two suggestions, move the buffer clear and skip the graph for zeroes.
I Only put the switch on the graphing part, you can do the same for the read visa. Also, you have to decide how to send your text data if one of the VISA reads is blank.
In other words, you can skip the graph but log the blank read, or skip the graph and decide what to do with the data because the data you save appears to be using both reads, and if you skip one .... Hope that all makes sense, it was written in the spirit of familiarity with this VI's code, so i am speaking loosely.
file is snippet, save to desktop, drag/drop to empty VI.
06-14-2012 12:55 PM
Thanks Mark, this is great! I think I will modify the code to skip writting to log file altogether if the value is zero. Thanks again!
--Yazan
06-14-2012 01:11 PM
A few basics about the VISA Read should prove helpful. The VISA Read returns when the number of bytes is read, when the termination character is detected, or when the timeout is reached. So, with the termination character enabled, you just specify a byte count that you know is greater than a single transmission. The read will automatically return as soon as the term character is detected. Again, in this type of situation, you do not need a wait function or the VISA Bytes at Serial Port.
06-14-2012 03:29 PM - edited 06-14-2012 03:37 PM
Hi,
Here is an update with the suggested changes from Dennis. Let me know if this is on the right track. I did not put a number in for the termination character, this would need to be looked up.
Judging from the screen shot from the 3rd party app it looks like there is a repeating pattern of CR and LF at the end of each message. So I put in a double read in each loop. The second read to clear those second set of LF CR characters out of the buffer. To make it work add the numeric value of the second character in the pattern.
If this works then technically you could remove the switches to turn off the graph and log. However, leave them in in case there is a legit "0" returned in error or some type of time out.
By the way, why are there no writes, are these instruments sending all the time, so to speak?
By the way, I probably should have set the term char using the serial port config, but property nodes are just so fun :manembarrassed: