Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa error -1073807339 when reading or writing to com 2

Good morning,

I am using both com 1 and com 2 to communicate with instruments using Labview 7.1 and Windows XP. Com 1 which works without any problems is communicating with a HP 34970A and com 2 which sporatically works is communicating with a Valhalla 2430 power analyzer. When I get the error, I open MAX and com 2 has an explanation point indicating a problem.

Thanks for your help.

Everett
0 Kudos
Message 1 of 21
(4,751 Views)
why not use MAX to communicate thru com2? this is the back door.
debug the vi is another door.
Set the break points way along to the error point.

good luck,
dong
0 Kudos
Message 2 of 21
(4,719 Views)
Well, there's several reasons you might be getting a timeout. One is that the instrument simply doesn't have any data to return. This could be because a setting or command is invalid, trigger not found, or whatever. Another reason is that you're asking for more bytes than what the instrument sends. Is this a driver you wrote or one you got from Valhalla? Posting the code would help. I'm not sure why you would get the exclamation point in MAX. Can you click on it and get any other info?
Message 3 of 21
(4,712 Views)
Good morning and thanks for your replies.

The exclamation point is gone now. The driver is from Valhalla. It is Infratek xo6a and appears was written with Labview 6i. I am using 7.1 What is strange is that sometimes it will work although not lately. I noticed from the lower level vi's that it is using "old VISA open" although that is not where the error is coming from. The read buffer is correctly set at 32. The VISA write before the VISA read that is creating the error has the string *IDN?\n which I assume is correct. I wonder if some kind of delay needs to be put in around the read? I also noticed that the Valhalla 2430 setup does not ask for a comm port, only baud, data bits, stop bits and flow control, but it works sometimes so I guess that isn't the problem. I have a Keyspan usb to serial adapter that I was thinking of trying. Thanks for your assistance.
0 Kudos
Message 4 of 21
(4,702 Views)
Everett,

That's interesting that the code works sometimes and not others. Also, you do need to specify the comm port. I am wondering if it does not work right after you have communicated over comm 1 and since you do not specify a comm port it is trying to communicate again with comm 1, when it should be communicating over comm 2. Have you seen any pattern? You might also put a 100ms wait in the code after the VISA write. Could you post your code so I could take a look at it? I'm interested to see what it's doing. Thanks!

JenK
Message 5 of 21
(4,697 Views)
Good morning again

I opened a VISA session in MAX for com 2, under basic i/o I executed a write and it returned a byte count of 6 and a returned value of 0. When I executed a read, it returned a value of BFFF0015 and no data. I did the same on com 1 where the HP Agilent 34970a is attached and it returned on the read a byte count of 33 bytes and the model number and backslash codes and a return value of 0 which I believe means no error whereas the hex number above must represent an error on com 2.
0 Kudos
Message 6 of 21
(4,694 Views)
Please post the VI from Valhalla. I think JenK may be right about the driver assuming that it's on Com1. Can you communicate to the instrument using Hyperterminal?
Message 7 of 21
(4,691 Views)
Hello again and thank you for all the responses. Valhalla charges money for their driver so I doubt they would want it posted in the discussion forum. I ran NI-Spy and will attach the logs. I also changed the byte count from 32 to various lower numbers but 21 seems so far to operate without an error running the Valhalla VI only. This afternoon I will try it again in the program to see if an error occurs or if I don't get my data sometimes. Capture 1 was done using max and open visa for com 2. I ran it several times. Capture 3-1 is after I changed the byte count to 21 and added some delay on the VISA read.

For some reason it won't let me post a .spy extension

The file does not have a valid extension for an attachment. jpg,gif,txt,xls,vi,zip,doc,bmp,llb,pdf,png,seq,c,h,cpp,cs,vb,ini,gz,ctl,scr,ico,tar,z,uir are the valid extensions


Everett
0 Kudos
Message 8 of 21
(4,500 Views)
Final observation for the day

I ran my program with an exclamation point on com 2 in max and data was returned correctly for 100 reads. I closed Labview and opened max again and the exclamation point over com 2 was gone. I tried to run the program again and got the same error as before.
0 Kudos
Message 9 of 21
(4,667 Views)
hi,

the error you got in MAX probing on com 2 is the key point.
please test IDN? and other existing codes in MAX.
try to test different inputs according to the programming rules of your Valh***.
Valh*** would thank you for advertisement. please not put here the original codes,
but you can disclose some portions that you believe NI won't charge you.

I also met frequently the so called "exclamation point". It is yellow.
But I got no problme with communication.
It is unknown why they set it in.
0 Kudos
Message 10 of 21
(4,651 Views)