Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Control Instrument using RS232 port

I have tried to download the IVI driver of the Agilent E3633A that stated can communicate using GPIB or Serial.

I tried to initialize the instrument but no successful.

I used a twisted ( tx and rx swap) RS232 cable (female to female) to connect between the instrument and PC com port.

Please help to advice on how to control the equipments using RS232 port inlabview. Thanks!
0 Kudos
Message 1 of 6
(5,014 Views)
Hi Rebecca,

You first need to make sure you can communicate with your instrument in MAX through both GPIB and serial. Secondly, make sure you have installed the IVI Compliance Package (the link to this download is on the driver's download page). Finally, make sure the serial settings on the instrument exactly match the serial settings in MAX. This is very important.

I hope this helps.
Vesna
Message 2 of 6
(5,001 Views)
Hello,

Here's what you can do to verify that you have established communication with the instrument.

First gather the relevant information:
--------------------------------------

1. Find a command that you know your instrument "understands" (it is highly likely that it will understand *idn? which should prompt the instrument to reply with a description of itself).

2. Verify the serial settings that your instrument uses by default, such as baud rate, number of data bits (likely 8), parity, and the number of stop bits. You can also verify what termination character the instrument uses (which it likely does); this is the last character you will need to send after sending the relevant command characters, and it will indicate the end of the command to the instrument so that it stops reading from the serial port. I doubt that the instrument is configured for flow control of any kind by default, so don't worry about that unless there is specific indication of this in the manual for your instrument.

3. Verify the type of your cable; that is, you will need to connect pin 2 of your computer's COM port to pin 3 of your instrument's COM port, and pin 3 of your computer's COM port to pin 2 of your instrument's COM port. Some cables automatically switch these connections with the wires inside the cable, others are "straight through." You can bypass the cables altogether and just use wires to make the relevant connections initially; don't worry about a twisted pair at first, just keep the wires short and you should be ok (unless you are in a particularly noisy environment).


Now build the LabVIEW program:
------------------------------

1. Open a blank VI
2. Navigate to and pin down the following functions palette on the block diagram:
All Functions -> Instrument I/O -> Serial
3. Place onto the block diagram the four VIs/functions in the top row in the order they appear (should be VISA Configure Serial Port, VISA Write, VISA Read, VISA Close); note that the open will be performed implicitly the property node inside the VISA Configure Serial Port VI (don't worry about this).
4. Hover over the upper left hand terminal of the VISA Configure Serial Port VI, right click, and choose
Create -> Constant; now select the PC COM port you connected your instrument to in the newly created constant
5. Create constants for the inputs to match the serial parameters that you found for your instrument above if the default values don't already match. Note that the defaults used by this VI include activating the linefeed termination character to be used when reading, as well as standard settings for serial port which may already match your instrument (check by hovering over the ports with the wiring tool; the default values will show in parenthesis)
6. Wire the top right hand terminal to the top left hand terminal of adjacent VI's (which should be in the order noted above); this connects the resource name to each so they perform the operations on the chosen serial port
7. Wire the bottom left to the bottom right hand terminals in a similar fashion; this connects the error clusters
8. Almost done... now hover over the remaining left input of the VISA Write function (called write buffer), right click, and create a constant; type *idn? (and include a linefeed character at the end by typing the key)in the string constant that you just created
9. Similarly for the read function, create a constant for the input that indicates the number of bytes to read (perhaps make this number 100 as you will likely terminate the read appropriately when a termination character is read; your instrument will likely send this), and create an indicator for the "read buffer" output which will show you the string that is read back when you run the program.
10. You should now be able to run the program; hope it works.

I would have included a screenshot or example instead of a description, but I don't have access to that at this time and perhaps it is best to actually go through the process of building the VI anyway if you are new to LAbVIEW.

Good luck and repost if you continue to have troubles!

Thank you,

Best Regards,

JLS
Best,
JLS
Sixclear
Message 3 of 6
(4,996 Views)
hi,

I really wonder you can connect them with a female-female cable. But hope you have a special case.

At first, your problem is to know if your vi can communicate thru RS232. In NI.com, you can download a petite vi, called loopcheck or loopback.vi. Simple to do is, take out the RS cable, instead connect pin 2 and 3 of PC connector with each other. Better you can do by following that instruction in that website. Run that vi, and if you can get echo to any symbol you write, then your RS connector works, and you can be sure its parameter.

Second, you have IVI drivers. So read things available in NI.com about these special drivers. I guess you know to search in ni these topics. Follow the instruction there to download any necessary software, all free from ni, but note that the version is important. After installation, use MAX to check if they are listed there. For installation, some need be installed in the root directory, i.e. c:\, so you must allow that.

I bet you can learn a lot from searching those available info in ni.com. They are 24 hours open.

Why other softwares? because IVI involves some DLLs or others, which need be installed and located in the right place.
Message 4 of 6
(4,914 Views)
hi,

forgive me if you know this link:

http://sine.ni.com/apps/we/niid_web_display.download_page?p_id_guid=E3B19B3E91E8659CE034080020E74861

and this for loopback test:

http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3ED2A56A4E034080020E74861&p_node=DZ52058&p_submitted=N&p_rank=&p_answer=&p_source=External

It is interesting to see here the message is inevitably long.
0 Kudos
Message 5 of 6
(4,910 Views)
Hi All,

Thanks for the info. I've solved my problem.

In conclude, if we have to control the instrument serially using instrument driver directly, we must download the driver with SERIAL option (which most of them are IVI). Then, can directly use the subvi that alreayd built, which share between serial and gpib.

Thanks a lot!
0 Kudos
Message 6 of 6
(4,897 Views)