08-26-2020 03:25 PM
Hello, I'm a new LabView user trying to create a VI that will receive a csv string from a scale add a date time stamp and post the data to an access database. I'm using a 32 bit ODBC connection to the database. There are 3 potential string lengths calibration is only one column, pass and fail are 6 columns. I've seen the problem on the pass and fail but not the calibration. It works most of the time but occasionally the database record will be split in the middle and half of the data is in one record and the other half is in the next record. I've tried adding delays thinking that there was a timing issue with the data coming from the com port of the scale but even with the delays the issue occurs. I've also tried increasing the bytes at the com port to wait until the complete string comes to the com port but it still happens. I can also see the break on my front panel too so I don't think the problem is between the VI and the DB. I tried adding the column names to the DB insert but it didn't work so I took it back out. I'm at a loss why this is happening, any advise would be much appreciated.
Solved! Go to Solution.
08-27-2020 08:34 AM
Hello,
your problem is that you do not check if the string you get from "Read VISA" is a complete record set. Just reading a bunch of characters that are currently available in the buffer does not ensure that this buffer has all the data you would like to have.
Possible solutions:
Regards, Jens
08-27-2020 02:32 PM
Thanks Jens! That makes perfect sense. I'll give it a try.
09-01-2020 12:18 PM
I've added the termination character and increased the bytes read to 1000 and the broken records is fixed but now I'm getting a VISA timeout error. This error occurs after about 10 seconds with no data. After acknowledging the error I'm able to continue sending data. I changed the port setting in NI-VISA for the termination character and I've tried replacing the simple error handler with a general error handler and clear error to prevent the error from stopping execution but the port still times out even if there is no pop up error. When this happens it records a date time stamp with no data and will continue to do this every 10 seconds until I stop execution or data is actually on the port and it will record.
09-01-2020 03:47 PM
I've found a solution that works. I created a case for calibration, pass and fail string lengths. The default does not do any concatenation or database entry. For anyone with a similar project I've attached examples of each case.