Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
7 ratings:
 4 out of 5   

Why Does My Serial Instrument Not Respond to Commands?



Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: 8.2
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems

Problem:
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?

Solution:
To troubleshoot an instrument that is not responding to commands you should run through the following steps.
  1. Make sure your cable works. A broken cable might cause this problem.
  2. Use a null-modem to reverse the receive and transmit signals in computer-to-computer communication with serial I/O.
  3. 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 Carriage Return 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 Point
KnowledgeBase 1749FBTR: How Do I Add Termination Characters to VISA Serial Writes in LabVIEW?
Tutorial: How to Do a Serial Loopback Test
LabVIEW 2012 Help

Attachments:





Report Date: 09/22/2000
Last Updated: 05/04/2016
Document ID: 21LCJ1LI

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit