Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Agilent 34970A labview rs232

Hi,

 

I have a program that reads voltages and temperatures every ~10seconds. There is also an actuator card which will turn on and off heaters depending on the temperature of the thermocouple attached to it.  The error I am having is in the communication with the Agilent 34970A. The communication via GPIB has no problems (used when I need multiple Agilent units), however there are random problems when using RS232. It normally takes a day or two before the error occurs, I come back and the Agilent shows that there were several "Query Interruption" errors, which causes some unexpected data.

 

I want to leave the session to the COM port active, since I will be calling the serial port regularily and nothing else should be using the port. I have been messing around with this code for a while, it seems like it's becoming more complicated than it needs to be. If anyone could give me some advice it would be appreciated.

 

 

 

 

 

 

rs232.GIF

0 Kudos
Message 1 of 6
(7,732 Views)

Hi

 

I would put the init and close in separate vi's but that is not the problem.

Why are you issuing a clr each call?

Does that help?

I would move that to the initialize or remove it completely.

And which version of visa are you using?

greetings from the Netherlands
0 Kudos
Message 2 of 6
(7,724 Views)

Thanks for the quick reply. The 'Clear' call was just one the the things I added in to see if it would fix it.  I was getting the error prior to adding it, and I thought that clearing the buffer might help fix the problem (but it didn't). I have removed it.

 

I am running the test again right now with a few other modifications. I am doing a check on the number of bytes available on the port, and reading until I receive a  new line return. I put that in a loop which will run for up to 10 seconds. (I thought this is what the regular read command should do, but the old code I have from the previous developer works and thats what he did).

 

I am using VISA 4.3 (all our computers are running XP) 

Message Edited by Loganmc on 12-16-2009 01:16 PM
0 Kudos
Message 3 of 6
(7,721 Views)

You can activate the endchar enable and make sure the correct endchar is supplied.

And where is the byte count coming from.

I  don't expect a problem but why are you using local vars (in init and with #bytes) 

greetings from the Netherlands
0 Kudos
Message 4 of 6
(7,716 Views)

The default endchar is a line return, so I never bothered setting it (don't know if it is better practice to always put it in there).

 

The byte count was just how many characters to read, it was just a control that was always set to 1024 bytes, large enough for any return data. The new modifications I made would only read what is available, so the byte count variable is gone.

 

Is it better practice not to have local variables on this sort of vi? 

0 Kudos
Message 5 of 6
(7,706 Views)

Hi

 

It is always better to have no local vars if not really needed. They can introduce race conditions in your code!

 

Indeed make that bytecounta constant and make sure you send a linefeed and/or a carriage return.

I don't know the character line return....Smiley Very Happy

 

But check also what you send out. The output character that you expect to be sent is only there when explicitly asked for.

greetings from the Netherlands
0 Kudos
Message 6 of 6
(7,684 Views)