LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intermittently empty values in visa read

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.

 

 

0 Kudos
Message 11 of 15
(694 Views)

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.

-------
Mark Ramsdale
-------
0 Kudos
Message 12 of 15
(682 Views)

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

0 Kudos
Message 13 of 15
(663 Views)

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.

0 Kudos
Message 14 of 15
(659 Views)

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:

 

 

 

-------
Mark Ramsdale
-------
0 Kudos
Message 15 of 15
(650 Views)