LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Communication with Agilent 34970A

Solved!
Go to solution

Hey everyone,

 

I'm currently trying to communicate with an Agilent DAQ using a USB-RS232 Interface with FTDI chipset. I can get as far as *IDN? but any other SCPI commands don't work over the RS232 interface for some reason, writing but not generating a read signal. Eventually it generates an error 103 on the instrument, which the guidance in the manual says "-103 Invalid Separator" even if I'm putting in the command SYST:TIME? just to gauge if commands are working.

 

Has anybody ever encountered this sort of error before? This is my first time working with an RS232 interface instead of GPIB, but I think I'm set up correctly. Both settings on the DAQ and in NI MAX match up, and I checked the interface but shorting he interface pin 2 to 3 to check if it's reading wrong, so that's working correctly.

 

Thank you in advance,

 

Anthony

0 Kudos
Message 1 of 18
(16,312 Views)

Hmmm I use these all the time serial and GPIB but haven't seen that error.

To start off the 34970A needs a null modem cable, but since you are getting an error response I take it you are using the right cable.

 

What about your serial settings? I have found that when using baud rates over 9600 you have to use a proper null modem cable with all the hand shaking lines and use RTS/CTS flow control, not Xon/Xoff

 

Also the serial cable that comes with the 34970A is NOT a "proper cable" as it does not have the hand shaking lines only Rx, Tx, and ground.

 

Now I have to ask why you are tying to use the SCPI commands? 

As the Instrument Driver for the 34970A is well written and  complete 

http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=014F4CD7EF78136AE0440003BA7CCD...

 

========================
=== Engineer Ambiguously ===
========================
Message 2 of 18
(16,279 Views)

So I am using their VIs in my LabVIEW program (I really enjoy their dedication to making quality VIs), however I can't get the first portion to work, where I can actually communicate successfully with the instrument. If I plug the instrument into my LabVIEW program it fails the Initialize.vi functions, I'm assuming becasue it isn't communicating properly.

 

http://www.digikey.com/product-detail/en/ftdi-future-technology-devices-international-ltd/UT232R-200...

 

Here is a link to the connector I am using, which I believe should be right. 

 

I've tried baud rates of 19200, 9600, and 4800, with flow control of Xon/Xoff, RTS/DTS, and none, and different parity options all around. None of them seem to fix the issue.

0 Kudos
Message 3 of 18
(16,261 Views)

I recommend you to use Keysight command expert and try to use connect over rs232, it will prove the serial cable & settings are correct, then you have problem with your LV code. 

 

http://www.keysight.com/en/pd-2036130/command-expert?cc=GB&lc=eng

 

0 Kudos
Message 4 of 18
(16,217 Views)

Thank you for the advice - I have installed the program, and have been able to do about the same as when I was using NIMAX. I built a small program here to read the output of one channel (this was an example script that they listed under one of the options). No matter how small the script, or how long, it always gives the same error on the last line.

 

HRESULT 0x80040015 SCPI connection attempt timed out.

 

I have double checked to make sure that all of the settings on the instrument match the settings through Keysights app, and they are both in sync. *IDN? works, however the rest of the functions don't seem to function on the instrument

0 Kudos
Message 5 of 18
(16,168 Views)

Update on the cable: It is a null modem cable. I have an FtF RS232 61601 in between the USB to RS232 and the RS232 on the instrument.

0 Kudos
Message 6 of 18
(16,154 Views)

@AnthonyMN wrote:

Update on the cable: It is a null modem cable. I have an FtF RS232 61601 in between the USB to RS232 and the RS232 on the instrument.


Well I can tell you that cable is only good for 9600 baud with Xon/Xoff flow control as it does not contain all the handshaking lines needed for faster speeds and hardware flow control like RTS/CTS.

========================
=== Engineer Ambiguously ===
========================
Message 7 of 18
(16,152 Views)

Alright, so I have it configured for that, Xon = x11, Xoff = x13, and it's still reading incorrectly on anything except the standard commands (*IDN). I know that this instrument works through GPIB, however it seems like it doesn't recognize anything outside of the IEEE 488.2 Common Commands on RS232 for some reason.

0 Kudos
Message 8 of 18
(16,148 Views)
Solution
Accepted by topic author AnthonyMN

@AnthonyMN wrote:

Alright, so I have it configured for that, Xon = x11, Xoff = x13, and it's still reading incorrectly on anything except the standard commands (*IDN). I know that this instrument works through GPIB, however it seems like it doesn't recognize anything outside of the IEEE 488.2 Common Commands on RS232 for some reason.


That is really confusing to say the least as in my experence if the *IDN? querry works from a terminal or VISA test panel you are golden...

 

In fact I just hooked up a 34970 on my desk here using a "generic" USB to Serial adaptor and one of the Agilent null modem cables and tried a quick program to check.

 

Ag1.png

 

It seems to work fine for me...

 

Ag2.png

 

I really don't know what else to recomend...

========================
=== Engineer Ambiguously ===
========================
Message 9 of 18
(16,136 Views)

So throwing it into LabVIEW seems to have fixed it. I'm not sure exactly what happened that manually throwing SCPI commands at it wasn't working out, but it's working now, so I guess I'm on to debugging the program now.

 

Thank you so much for your continued help and patience on this!

0 Kudos
Message 10 of 18
(16,128 Views)