Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
14 ratings:
 3.92 out of 5     Rate this Document

Writing Control Characters to a Serial Port in LabVIEW

Hardware: PXI/CompactPCI>>Controllers

Problem:
I need to send a string to a serial device that includes a control character such as "Ctrl+B", but LabVIEW will not display anything in the write buffer when I enter Ctrl+B on the keyboard.  How do I write control characters to a serial port in LabVIEW?

Solution:
To write control characters to a serial device, you have to enter the hex value of the control character into the write buffer when the write buffer is in hex display mode. For example, if you wanted to send "Ctrl+B" to a serial port, you would enter "02" into the write buffer when it is in hex display mode. Scroll down to see a table of hex values for all of the possible control characters.

Dec Hex ASCII Key
0 00 NUL (null) ctrl @
1 01 SOH (start of heading) ctrl A
2 02 STX (start of text) ctrl B
3 03 ETX (end of text) ctrl C
4 04 EOT (end of transmission) ctrl D
5 05 ENQ (enquiry) ctrl E
6 06 ACK (acknowledge) ctrl F
7 07 BEL (bell) ctrl G
8 08 BS (backspace) ctrl H
9 09 HT (horizontal tab) ctrl I
10 0A LF (line feed) ctrl J
11 0B VT (vertical tab) ctrl K
12 0C FF (form feed) ctrl L
13 0D CR (carriage return) ctrl M
14 0E SO (shift out) ctrl N
15 0F SI (shift in) ctrl O
16 10 DLE (data link escape) ctrl P
17 11 DC1 (device control 1) ctrl Q
18 12 DC2 (device control 2) ctrl R
19 13 DC3 (device control 3) ctrl S
20 14 DC4 (device control 4) ctrl T
21 15 NAK (negative acknowledge) ctrl U
22 16 SYN (synchronous idle) ctrl V
23 17 ETB (end of transmission block) ctrl W
24 18 CAN (cancel) ctrl X
25 19 EM (end of medium) ctrl Y
26 1A SUB (substitute) ctrl Z
27 1B ESC (escape) ctrl
28 1C FS (file separator) ctrl \
29 1D GS (group separator) ctrl [
30 1E RS (record separator) ctrl ^
31 1F US (unit separator) ctrl _

An ASCII table for other characters can be found in the Related Links section at the end of this document.

Related Links:
KnowledgeBase 43FDH92W: Send or Receive Binary / Hex Data Using NI-VISA in LabVIEW

External Link: ASCII Table

Attachments:





Report Date: 10/04/2004
Last Updated: 01/21/2009
Document ID: 3E3ASSXR

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