Introduction to sample LabVIEW VIs
for device control
Ver1.01e 1
Contents
• Introduction to our sample VIs
• What can our sample VIs do?
• What is needed to run our sample VIs?
• Details of our sample VIs
• What is in our ZIP file?
• How to run our sample VIs
• How to change the serial communication speed
• Properties of Front Panel Controls and Indicators
• How to send commands only when needed
• How to utilize our sample VIs
• Error Messages
• Contact Us
Ver1.01e 2
Introduction to our sample VIs
• Purpose of our sample VIs?
Our sample VIs simplify the control of measurement instrumentation by enabling the sending and
receiving of SCPI commands via NI LabVIEW 2017 or later using the VISA Write & Read function.
You can easily control devices, such as power supplies and measuring instruments, by modifying
the initial value of our sample VIs, according to the user’s manual or communication interface
manual.
As a typical example, we provide our sample VIs specifically for our DC power supply PMX18-5A.
• Intended user
Our sample VIs are designed for development engineers who need guidance in creating VIs to
control the devices via LabVIEW 2017 or later.
• What is needed to run or modify our sample VIs?
NI LabVIEW 2017 or later (either the production, evaluation or community edition) is required.
You can download it from the following website:
LabVIEW Download – NI
*LabVIEW Community edition has no expiration date but is for non-commercial use only.
(Please check the license.)
Ver1.01e 3
What can our sample VIs do?
• Connect a PC and device
Select the VISA resource name from the VISA
resource name pull-down menu. Click Operate >
Run to open the VISA session and establish a
communication link with the device.
• Send a command
[Command] button
Select the command from the Command Message
pull-down menu. Click Command to send the
command to the device. You can also manually
send commands that are not in the pull-down
menu.
• Send a query command
[Query] button
Select the command from the Query message
pull-down menu. Click Query to send the query
command to the device. The result data is
returned and displayed in the Received character
string field. You can also manually send query
commands that are not in the pull-down menu.
• Read a status byte register
[ReadSTB] button
Click ReadSTB to execute the ReadSTB method.
The value of the status byte register is displayed in
the Status byte field.
*Available only when connected via the GPIB or
USB interface.
Ver1.01e 4
What is needed to run our sample VIs?
• Windows PC with the following requirements
– NI-VISA 19.0 or later
– LabVIEW 2017 or later (32-bit version)
* The sample VIs compatible with LabVIEW 2011 to 2016 are also included.
* The sample VIs were tested on the LabVIEW 32-bit version, but it may also run on the 64-bit version as they uses
only standard functions.
• Connection Cable
You will need one of the following connection cables.
– USB connection: USB cable (USB Type A-Type B)
– Serial connection: Serial cable (9-pin cross type)
USB-RS232C conversion cable
(e.g., REX-USB60F manufactured by RATOC Systems, Inc.)
*If your PC has a serial port, the conversion cable is not required.
– GPIB connection: USB-GPIB conversion cable
(e.g., USB-GPIB-HS manufactured by National Instruments)
*Use the cable that supports the VISA COM library.
You cannot use the GPIB-USB cable by RATOC Systems, Inc.
– LAN connection: LAN cable (cross-type)
*In case of AUTO-MDIX LAN interface, straight cables are also available.
• Device such as measuring instrument or power supply
̶ You will need the device that supports the SCPI commands (e.g., PMX-A, PWR-01), with the following
interfaces:
• GPIB interface
• Serial interface (RS232C)
• USB interface (USBTMC)
• LAN interface (VXI-11, HiSLIP)
Ver1.01e 5
Details of our sample VIs
• Contents of the ZIP file
– The set of LabVIEW 2017 VIs, including sub-VIs
– The set of LabVIEW 2011-2016 VIs, including sub-VIs
• Please save all sub-VIs to the same folder after unzipping.
• Programming Language
– LabVIEW 2017 language
– *The sample VIs compatible with LabVIEW 2011 to 2016 are also included.
• What can our sample VIs exactly do?
– Sending and receiving commands using the VISA Write/Read function (VISA Write.vi and
VISA_Query.vi)
– Opening the VISA session and setting the RS-232C baud rate (VISA Open.vi)
Since no specific IVI driver is included in the sample VIs, you can use them for different devices.
• Precautions before implementing our sample VIs
– You can modify our sample VIs, but please note that they are provided only as a reference of your
programming.
– Our sample VIs do not guarantee complete operation in all environments.
– Error handling has been minimized to simplify our sample VIs.
We strongly recommend handling all errors on your actual system.
Ver1.01e 6
What is in our ZIP file?
• The following sample VIs are included.
Please extract all VI files to the same folder.
VIs for LabVIEW
2011 - 2016
Main VI
Ver1.01e 7
How to run our sample VIs
• Install LabVIEW.
• Connect your PC and device.
• Double-click ‘Sample_vi_Verxxx.vi’ (where ‘xxx’ is the
sample VI version number).
• The front panel window will appear. Click View >
Tools Palette to display the Tools palette. Click the
Operating Tool icon.
• Click the downward arrow [▼] of the VISA resource
name dropdown and select the resource name of
the device you want to connect.
If the resource name does not appear in the
dropdown, click Refresh.
• Click Operate > Run (or click the play icon [=>]) to
open the VISA session and establish a
communication link with the device.
• Select a command in the Command message field.
Click Command to send the command to the device.
• Select a query command in the Query message field.
Click Query to send the query command to the
device and receive the query response.
• Click ReadSTB to receive the status byte.
• Click Stop to stop the sample VI.
Ver1.01e 8
How to change the serial communication speed
• Click Window > Show Block
Diagram on the front panel to open
the block diagram.
• Click View > Tools Palette to open
the Tools palette. Then, click the
Labeling Tool icon.
• Change the value of Serial
communication baud rate on the
block diagram and save the change.
• If you want to modify parameters
other than the baud rate, double-
click ‘VISA_Open.vi’ to edit
parameters such as stop bit and
XON/OFF.
Ver1.01e 9
Properties of Front Panel Controls and Indicators
• Our sample VIs utilize the
property node to modify the
settings of the front panel
controls and indicators.
• Right-click on the nested control
on the block diagram.
Then, click Create > Property
Node to show the property.
• To switch the property node from
read to write, right-click on the
property node and click Change
to Write.
Ver1.01e 10
How to send commands only when needed
• The Case Structure function enables you to send commands only when
the Command button is clicked.
• In the Boolean properties dialog, choose either Latch when pressed or
Latch when released.
Ver1.01e 11
How to utilize our sample VIs
• You can integrate our sample VI into your own VI.
• To add the sub-VI to a block diagram, click on Functions palette >
Select a VI...
Ver1.01e 12
Error Messages
VISA Open Error
VISA Write/Query
Error
ReadSTB Error
Ver1.01e 13
Contact Us
• For any inquiries regarding the sample VIs, please
contact us using the following inquiry form:
https://global.kikusui.co.jp/contact/lead/
Please include the phrase “To the person in charge of
the sample code” in the text and provide your
question.
Kikusui Electronics Corporation. All rights reserved.
Ver1.01e 14