|| 4 out of 5
Why Does My Serial Instrument Not Respond to Commands?
LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version:
Primary Software Fixed Version:
LabVIEW Development Systems
I am trying to send commands to my serial instrument, but my instrument does not seem to be responding. How can I troubleshoot my commands and connection?
To troubleshoot an instrument that is not responding to commands you should run through the following steps.
- Make sure your cable works. A broken cable might cause this problem.
- Use a null-modem to reverse the receive and transmit signals in computer-to-computer communication with serial I/O.
- Run the LabVIEW shipping example Basic Serial Write and Read.vi, located in examples\instr\smplserl.llb and also accessible from the NI Example Finder, to establish communication with your instrument.
Many instruments expect a carriage return or line feed to terminate the command string. The Serial Port Write.vi
in LabVIEW sends only those characters included in the string input; no termination character is appended to the string. Many terminal emulation packages, HyperTerminal for example, automatically append a carriage return to the end of all transmissions. With LabVIEW, you will need to include the proper termination character in your string input to Serial Port Write.vi
, if your instrument requires it.
Some instruments require a carriage return, \r
; others require a line feed, \n
. When you enter a return on the keyboard, on PC keyboards this is the
key on the main alphanumeric keypad, LabVIEW inserts a \n
. To insert a carriage return, use Concatenate Strings
and append a
constant to the string, or manually enter \r
after selecting '\' Codes Display
from the string shortcut menu. Refer to the LabVIEW Help for more information about backslash (`\') codes display for strings. The LabVIEW Help file can be found by navigating to Start»Programs»National Instruments»<LabVIEW>»LabVIEW Help
If you now notice that the instrument responds only after a second execution of the write command, increase the delay before read (ms)
input to ensure that the write has time to complete before reading.
Related Links: Tutorial: Serial Communication Starting PointKnowledgeBase 1749FBTR: How Do I Add Termination Characters to VISA Serial Writes in LabVIEW? Tutorial: How to Do a Serial Loopback Test LabVIEW 2012 Help