LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware Interface - VISA issue?

Solved!
Go to solution

Hello,

 

I am trying to control several measurement instruments with LabVIEW.

 

The first one I am working on is a Fluke 43B. I set up a basic code where I ask it to identify itself. The code works but not consistently. When it does, the output string is always cut off no matter how much I increase the byte count on the Serial Read block. The most I got (in terms of the complete output string) was when I set the byte count to 256 but when I went higher it went back to not working. When the .vi doesn't work, it simply runs and then stops running with the error out telling me there was a problem with the Serial Read Block.

 

I apologize that I can't provide the error code, I had to leave the instrument back at the lab and won't have access to it until Monday. I thought I would submit the question over the weekend in hopes of having some leads when I go back to it. I was thinking the problem could be the fact that I haven't added the VISA Open and VISA Close blocks yet. Could it be that simple?

 

Any help would be greatly appreciated, the .vi is attached.

 

Thanks,

Yusif

0 Kudos
Message 1 of 6
(3,005 Views)
Solution
Accepted by topic author Akello

Yusif,

 

No. The VISA Open and Close are not causing the problem.  An Open is implicitly performed when you do the Write, or maybe when you Configure. Failure to close will not produce an error at Read although it might preven any other program from accessing the port and might cause a problem the next time you tried to Configure.

 

The real problem is termination characters.  You have enabled ending reads on receipt of a termination character. The default character is line feed. The Fluke transmits a carriage return at the end of each message.  Any message which contains a line feed character (decimal 10, hex A), will terminate the read with a warning (not an error) that more data might be present.  I have not looked through the entire command reference manual for the Fluke but at least one command can generate a line feed: Instrument status when the status value is 10 = Charging and AutoRanging.  It is likely that there are others as well.

 

The fix: Change the termination character to carriage return at the configuration VI. Then you should get complete messages.

 

Lynn

0 Kudos
Message 2 of 6
(2,991 Views)

Lynn,

 

Thank you that makes a lot more sense than it being the VISA Close. I've modified the code accordingly and will be trying it out on Monday.

 

Thanks again for the help,

Yusif Nurizade

0 Kudos
Message 3 of 6
(2,979 Views)

Lynn,

 

Thank you, that was the fix.

 

Actually I believe that the instrument gives you a carriage return in it's initial reply, along with a 0/1 for no error/error, respectively. Changing the termination character to carraige return got rid of the error but I had to add a second read for the actual data I was looking for. I'm curious if there is a better fix that does not require two reads but I'm content since it works and I get what I need.

 

Thanks for the help,

Yusif Nurizade

0 Kudos
Message 4 of 6
(2,955 Views)

Why aren't you using the driver that exists for it (Help>Find Instrument Driver)? It doesn't use multiple reads. If you had started with this instead of trying to write your own code, you probably would have been much further along by now.

0 Kudos
Message 5 of 6
(2,948 Views)

Dennis,

 

That's a valid point. Part of the reason was probably laziness but, in retrospect, the real reason I would prefer to write my own code is that this is a school project but the job I am interning for, and hope to do full time when I graduate, has me doing a lot of instrument control with LabVIEW. The are not always drivers available so I'd like as much practice as I can get. I will take a look at the existing driver, however, to see what I could have done differently.

 

Thanks for the suggestion,

Yusif Nurizade

0 Kudos
Message 6 of 6
(2,916 Views)