Control codes for serial communication

Typically, devices that communicate over serial connections are expecting to receive a control code, e.g., an ACK or a NAK. The following are some common control codes.

$SOH = chr(1); // start of heading
$STX = chr(2); // start of text
$ETX = chr(3); // end of text
$EOT = chr(4); // end of transmission
$ACK = chr(6); // acknowledge
$NAK = chr(21); // negative acknowledge

Leave a Reply