LabVIEWでシリアルポートに対してどのように制御文字を書き込む
使用ソフトウェア:
使用ソフトウェア・バージョン: N/A
使用ソフトウェア・バージョンに特化: N/A
二次のソフトウェア: N/A
ハードウェア: Serial
問題:
シリアルデバイスに"Ctrl B”のような制御文字を含んだ文字を送信したいのですが、キーボードでCtrl+Bと入力しても何も表示されません。LabVIEWでシリアルポートに制御文字を書き込むにはどうすれば良いですか?
解決策:
シリアルデバイスに制御文字を書き込むには、VISA書き込み関数の書き込みバッファ入力文字列を16進表示に変更して、制御文字の16進数を入力する必要があります。たとえば、シリアルポートに"Ctrl+B"を送信したい場合は、16進表示にした書き込みバッファに"02"と入力します。下記の表は、ASCII文字および制御文字の10進数、16進数が記載されています。
10進数 |
16進数 |
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 _ |
その他のASCII文字については、関連リンクを参照してください。
関連リンク:
技術サポートデータベース 43FDH92W: Send or Receive Binary / Hex Data Using NI-VISA in LabVIEW
外部リンク: ASCII Table
添付:
報告日時: 10/04/2004
最終更新日: 01/08/2016
ドキュメントID: 3E3ASSXR
Other Support Options
Ask the NI Community
Collaborate with other users in our discussion forums
Request Support from an Engineer
A valid service agreement may be required, and support options vary by country.