LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW error

Dear Sir/Madam, I have tried to use a LabVIEW program to read data from TPI597, Digital Hygrometer/Psychrometer. Please see the attached program and TPI597 manual (page7 about PC communication). l have two problems. 1. The data read by the LabVIEW program is much slower than these shown in the TPI597 screen. For example at 7:59, the humidity value on screen was about 94%. The LabVIEW program shew that data at about 8:03. 2. After about 15 minutes (sometimes 10 minutes) I got an error message as below, Error -1073807252 occurred at VISA Read in read RS232 .vi, Possible reason(s):VISA: (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived (see the attached error. I wonder if you can let me know what the problems are and how to solve them. Thank you very much Hongjun Niu

0 Kudos
Message 1 of 8
(2,131 Views)

Hi Chjn,

 

when a buffer overrun occurs you need to read the data more often/faster from that buffer!

 

I cannot open your VI due to its LabVIEW version but I guess you have an additional wait in your loop you use to read from the COM port. Get rid of that wait!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(2,116 Views)

Hi GerdW

Thank you very much. I have deleted the wait.  It works fine now.  If I would like to reduce the data file size, is it possible to record the data every 30 or 60 minutes?

Best regards

CHJN

0 Kudos
Message 3 of 8
(2,105 Views)

OK, I've looked at your code.  Here are some comments:

  • You want to Open and Close VISA outside the While Loop (open once, read possibly many times, then close once).
  • You are using the "default VISA Serial Settings" which should be OK for your device.  The Manual says the device talks at 9600 Baud, N-8-1, which matches the VISA Configure Serial Port.  It does not describe the data format, but it seems as though they are sending lines of code (i.e. each reading ends with a <LF>), which is also the Default Setting.
  • Change the VISA Read to specify a more reasonable upper limit to the line, like 100 characters.  Your lines will probably be <20.  Not that you should look at what comes out to verify this.
  • You get a short (I assume) reading every 5 seconds.  At present, you are saving all of them.  Nothing wrong with that, but if you only want to save one reading every 30-60 minutes, just put a timer or counter in the loop and save every Nth value (or every 30-60 minutes "by the clock", a little more complicated computation).
  • Look at the Write Delimited Spreadsheet file.  The first time you write to it, you want a "New" file (I presume), but all other times, you want to append.  The "LabVIEW" way to do this is to use a Shift Register (I do hope you know what this is).  Wire the left (inside) edge of the Shift Register to the Append to File? input (and wire "F" to the outside left edge so that it starts out as False), and wire "T" to the inside right edge so all subsequent calls see "T".
  • If all you want are the date and time (to the nearest second) as a string, I strongly recommend you use Format Date/Time String, which (if you leave the TimeStamp input unwired) gives you something like 5/16/2019 2:22:12 (guess when I ran this little function ...).  If you want a different format (or time in tenths of seconds), you can right-click the function, get Help, read the Detailed Help, and learn how to change the Date/Time Format yourself (it's a little complicated ...).
  • Congratulations for not using the (incorrect) term "Excel" in your post.

Bob Schor

 

0 Kudos
Message 4 of 8
(2,090 Views)

Hello Bob,

 

Many thanks for your suggestions. I will try them and let you know the progress.

 

Best regards

CHJN

0 Kudos
Message 5 of 8
(2,071 Views)

Hello Bob,

 

Many thanks. I am back to work on the program.

To save one reading every 30-60 minutes is most important for me. I try to add a case structure in the loop and using Shift Register (see the attached), but it does not work well.

You mentioned to put a timer or counter in the loop and save every Nth value (or every 30-60 minutes "by the clock", a little more complicated computation). I wonder if you can let me know more details.

Best regards

0 Kudos
Message 6 of 8
(2,030 Views)

You are putting the tick count difference into the shift register.  Why?

You should be putting the value back into the shift register when the time has not elapsed, and the new tick count value in when it has elapsed!

 

Try running your code with highlight execution turned on.  Watching the values flow down the wires would have clued you in.

 

You can also use the Elapsed Time Express VI in the timing palette.  We generally try to avoid Express VI's, but this is one of the better ones that I do use when I need to.

0 Kudos
Message 7 of 8
(2,010 Views)

Hello RavensFan,

Thank you very much. I have put the Elapsed Time Express VI in the loop and it works now.

When I put Set start time to 0 and Time target to 10 seconds. I get 12 or 13 second from tick count difference. But it marches better if I put Set start time to 0 and Time target to 30 seconds.

Best regards

0 Kudos
Message 8 of 8
(1,993 Views)