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