LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -1073807253 occurred at VISA Read in transient SR830.vi VISA: (Hex 0xBFFF006B) A framing error occurred during transfer.

Solved!
Go to solution

Hi,

 

I am have written a program with labview to make transient c-v measurement using a stanford research SR830 lockin amplifier. The program seems to be runing fine, but sometimes it is givvibg an error:

 

Error -1073807253 occurred at VISA Read in transient SR830.vi
Possible reason(s):
VISA:  (Hex 0xBFFF006B) A framing error occurred during transfer.

 

Error -1073807253 occurred at VISA Read in transient SR830.vi
Possible reason(s):
VISA:  (Hex 0xBFFF006B) A framing error occurred during transfer.

 

but if I press ok, the program again starts running. What might be the poblem? BTW I googled a bit and I see that in the labview topic "RS-232 Framing Error with HP 34401A Mulitmeter" by pkennedy32 this is what is said about framing error:

 

""Framing Error" in an RS-232 context means a very specific thing - when the receiver was expecting a stop bit, the line was not in SPACE condition. This can be the result of:

1... Baud rate mismatch (although other problems would likely crop up first).
2... Data Length problem, If I send 8 data bits and you expect 7, the stop bit is in the wrong place.
3... Parity setting mismatch - If I send 7 data bits + parity and you expect 7 data bits and no parity, the stop bit is in the wrong place.
4... Mismatch in # Stop bits - If I send you 7 Data bits + parity + one stop bit, and you expect 7 data bits + parity + TWO stop bits, the second one might not be correct, although most devices do not complain about this.
"

But, I must say that this is the same com port setting that I use to measure c-v hysterysis, but I never gt this error there.

I attach the program herewith for your kind perusal. Please help me resolve this issue.

Thanks in advance.

Download All
0 Kudos
Message 1 of 17
(7,490 Views)

Take out the VISA Close that you have in your loop. If you want to use it, it belongs outside the loop. At the same time you are changing this, remove the sequence structure. Not at all necessary. Use the Delay function instead of the Wait (ms) to give you error in/error out connections.

0 Kudos
Message 2 of 17
(7,487 Views)

Hi,

 

I have done as you say. I have used time delay and removed the sequence. Most importantly, I have placed the close VISA and simple error tab outside. There is no framing error any more but now I have a new problem. I have used the SNAP?1,2 command in the write VISA in the loop to query the CH1 and CH2 data simultaneously and read them as a string with the CH! and CH2 values separated by a string. Now, what the read VISA does is, instead of reading the whole string, starts from the last character and goes on increasing the no. of character as the loop is executed and once finished, reads the next string from bottom till front again. I attach you the modified program and sample output so that you understand. Thank you.

Download All
0 Kudos
Message 3 of 17
(7,479 Views)

I don't understand what you mean by starting from the last character, or reading the next string from bottom until front.  Serial communication doesn't work backwards or from bottom up.  So you'll need to give us a clearer idea as to what you mean.

 

The one thing I do notice is that you are requesting 20 bytes on the serial read.  Is that enough bytes to acquire all of your data?  I don't have your SR subVI's to see what is going on inside of them, but does the communication protocol use a termination character for when it reads the data?

0 Kudos
Message 4 of 17
(7,473 Views)

Hi,

 

In the read buffer I see that the CH2 data which preceed the "," is shown, but the CH1 data is shown partially, with one character incresing as the loop runs until it has the whole SNAP string "CH1,CH2". I donot really get this. But, if I change the time constant then it starts behaving in a different manner altogether. To sum it up, I donot get the whole CH1 and CH2 reading. I tried to increase the bytes at the read buffer, but if I increase it to somewhere around 23-24, it shows the whole data, but the operation times out even if I put a time constant to 30,000 ms. I really donot understand what is happening. Can you please sort out? I am attaching the subVIs too.

Download All
0 Kudos
Message 5 of 17
(7,466 Views)

Here is the data output file. Please see if you can make any sense out of it. It is supposed to be three columns one with time, the next is CH1 and the third is CH2. I am also attaching a clean data output (cvt-SiN-27.08) for comparison. One more thing is that when the timeout expires, the block diagram pops up pointing to the XY graphs

Download All
0 Kudos
Message 6 of 17
(7,464 Views)

The way the serial communication is configured, the VISA Read will terminate as soon as it detects a LF character. If the instrument is actually sending that, then yould can any arbitrarily high number for the bytes to read. Right click on read buffer indicator and select '\' Codes Display. Look for a \n. If you don't see it, then the instrument is not set correctly. Either change the instrument to send a LF at the end or change the iniitialize function to match what the instrument is currently sending.

Message 7 of 17
(7,454 Views)

The clean file makes it look like you are receiving about 30 characters.

 

You have a termination character enabled in the SR initialize subVI.  Is your device actually sending a termination character?

 

What really has me curious is your CSAC subVI.  You are using two local variables in there for length and offset.  Why?  I am willing to bet that you are creating a race condition that means whatever value you have in those local variables is unreliable and that is causing problems in decoding your received string.

 

Likewise, I have no idea why you are using a local variable for the Delay control in your main VI.  And why you are using a formula node express VI for something as simple as adding delay to the value in the shift register.

 

0 Kudos
Message 8 of 17
(7,452 Views)

@Dennis Knutson  you are right I checked the read indicator in backslash mode, and instead of a \n it is sending \r. So I changed the \n in my write strings to \r. But, if I keep the CLOSE VISA outside my loop instead of inside as you suggested, the termination character appears to come in the middle of the read string instead at the end. And since the read terminates at the \r so it is displaying some junk value before the \r, but if I put the CLOSE VISA outside the loop and play along with the bytes at the read buffer, I see the whole read string with the \r  at the end of the string. But, whenever the values are in exponential form (when close to zero) like 6.938839 e-5, I always get a time out error whatever be the timeout that I put at the VISA initialize. And subsequently, if I stop the program and run it again the machine program hangs and I donot get any reading. Then after I close it again and start, sometimes it hangs for some more or starts working. If I put an arbitrarily large byte count at the READ VISA, then I always get the time out before the operation completed error.

 

@ Ravens Fan I have removed the CSAC VI altogether and taking the CH! And CH” reading separately, instead as one string. So, no more issues with that.

 

I use the control at the delay so that I can choose how much delay I want to set, and I use the math operation because I am using adding up the delay time to keep track of the time elapsed. Because in the end I have t plot a time vs. CH! And CH” readings.

 

I am not sure but probably I am making some silly errors. Please help me out. 

Download All
0 Kudos
Message 9 of 17
(7,418 Views)
Solution
Accepted by topic author mssrb

You said when you look at the read string in \ mode, it is sending a \r which is a carriage return (decimal 13, hex 0D) instead of a \n which is a line feed (decimal 10, hex 0A).

 

But you did not fix your intialize sub VI to wire up a hex 0D into the termination character input of the VISA configure.  You have the termination enabled with a True, but nothing is wired up to the character input which means it is still using the default of hex 0A.

 

That is why you are still getting the termination character in the middle of readings, and timeouts if you ask for too many bytes,  It takes a long time to get X number of bytes, and it is never reading the termination character you designated.

 

Also, you need to have the VISA close outside the loop.

0 Kudos
Message 10 of 17
(7,411 Views)