LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

visa read doesnot show output from read buffer

Solved!
Go to solution

Hi 

 

I may be making some silly mistake, but my read buffer doesnot show any output in the indicator, it only shows 1. I am attaching the VI alongwith. Please help me out here, because I am really stuck. Thanks in advance.

Message 1 of 11
(8,950 Views)

You've configured your VISA session to have the termination character enabled for reads. That's the True constant wired to the VISA Configure Serial Port. Yet you are using Bytes at Serial Port. If you're using termination characters then using Bytes at Serial Port is not necessary. Just wire a large enough number to the "bytes to read" input of VISA Read, and the read will terminate once it sees the termination character. Be sure to set the correct termination character in the VISA Configure Serial Port.

 

In looking briefly at the manual for the SR830 I noticed it says that commands should be terminated with a carriage return OR a linefeed, not AND. You are sending both. I do not know if the SR830 is treating this as two commands, with one of them being empty.

 

I do not know if the above is the cause of your problem. If not, then I'd have to guess it's probably one of your commands being incorrect. You'd need to look at the manual in depth to see if this is the problem.

 

Aside: Your sequence frame is completely unnecessary. Use the error clusters for the Time Delay to control when they get executed, and ALL of your sequence frames can be deleted.

Message 2 of 11
(8,932 Views)

Maybe there is nothing there to read?

 

Try this put your read in a loop and wait for ther eto be something in the read buffer before doing the actual read.

 

Then set your bytes to read to some large amout.

 

Now it will wait until there are bytes to be read and then read all teh bytes until it times out.

 

You might have to play with the number of bytes to be read, the VISA timeout time to tweak for best performance.

========================
=== Engineer Ambiguously ===
========================
Message 3 of 11
(8,931 Views)
Solution
Accepted by topic author mssrb

Thank you guyz for your replies they are very helpful. I removed the bytes at port and a byte count of 8 in the VISA read seems to give me the result. I must confess that I had to change the write command string too as it was incorrect. It's not FPOP but OUTR. Now I can read the data. Thank you guyz again.

0 Kudos
Message 4 of 11
(8,919 Views)

Actually I must also say that the earlier command that I utilised gives me the Value of the Quantity i am measuring which is represented by 1. So, I was getting 1. But, the setting up of the bytes at VISA read was something that I learned from here, I always thought that I had to use bytes at port. Thanks.

0 Kudos
Message 5 of 11
(8,911 Views)

 


@mssrb wrote:

But, the setting up of the bytes at VISA read was something that I learned from here, I always thought that I had to use bytes at port. Thanks.


 

You are not completely understanding. It depends on the type of communication that you're doing. If you're using the termination character then there is no need for the Bytes at Serial Port since. VISA Read WILL stop reading once it sees the termination character OR it has read the number of bytes you've wired to the "bytes to read" input. Thus, if the device returns a message that's 50 bytes plus 1 byte for the termination, if you wire in a value of 25 to the "bytes to read", then all you'll get is the first 25 bytes. If you wire in a value of 200, then the VISA Read will stop once it gets to 51 bytes because it sees the termination character.

 

If you are NOT using a termination character then you want to use Bytes at Serial Port since you have to basically keep reading until whatever condition occurs that indicates you have the entire message.

 

 

Also, it is polite to mark the message that actually solved your issue (whichever it is), rather than marking your own thank you message as the solution.

Message 6 of 11
(8,900 Views)

I am sorry for the mistake. LOL

0 Kudos
Message 7 of 11
(8,893 Views)

Hi.. Even I am facing same problem. Visa read doesnt work sometimes in between.

 

I have not enabled termination character. I am using Instruction bytes at port.Please let me know what could be the problem

0 Kudos
Message 8 of 11
(8,616 Views)

 


@30904407 wrote:

Hi.. Even I am facing same problem. Visa read doesnt work sometimes in between.

 

I have not enabled termination character. I am using Instruction bytes at port.Please let me know what could be the problem


 

We are not mind readers. You have not shown us any code, and to say "doesn't work sometimes in between" means nothing. What does "doesn't work" mean?

 

You should start a new thread rather than hijacking someone else's thread where the question shows as having a solution.

Message 9 of 11
(8,611 Views)

@RTSLVU,

 

Can I ask what is that grey box around your components? Is it a loop? I am trying to follow a vi which has that box around a time delay 'wait ms' but i cannot find it in labview palettes.

0 Kudos
Message 10 of 11
(6,884 Views)