Serial Port Complete - Latest Microcontroller projects

(lily) #1
Formats and Protocols

The bits in each byte are numbered 0 through 7, with each bit representing the
bit’s value (0 or 1) multiplied by a power of 2. For example, a byte of

(^11111111) b translates to FFh, or 255. A byte of 00010001b translates to 11h, or



  1. In asynchronous links, bit zero, the least-significant bit (LSb), arrives first,
    so if you’re looking at the data on an oscilloscope or logic analyzer, remember to
    reverse the order when translating to a notation with most-significant-bit
    (MSb) first.
    Of course, a serial port can transmit values that have 16, 32, or any number of
    bits by dividing the value into bytes and transmitting the bytes in sequence. For
    multi-byte values, the transmitting and receiving computers must agree on the
    order that the bytes transmit.


1 
$


Some software treats data as text, with each text character expressed as a code.
Treating data as text is a convenience for programmers. Most programming lan-
guages enable storing text in two ways: as strings, which can contain one or
more characters, and as arrays of individual characters. Source code can request
to transmit a string such as “hello”, and the compiler or interpreter generates
code that causes the individual character codes to transmit. Or the source code
can request to transmit an array, with each item in the array containing a char-
acter code. At the receiving computer, software can store received character
codes in a string or array.
For applications that send and receive only basic U.S. English text, encoding
usually isn’t an issue. When sending or receiving special characters or characters
in other alphabets or scripts, the computers must agree on an encoding method.
The .NET Framework and other recent software use encoding methods defined
inThe Unicode Standard, a publication of the Unicode Consortium
(www.unicode.org). Unicode’s encoding methods support over a million charac-
ters in dozens of alphabets and other scripts, plus punctuation marks, math and
technical symbols, geometric shapes, and other symbols.
Unicode encodes text using code points and code units.
A code point is a value that identifies a character. Unicode code charts assign a
code point to each character. The conventional notation for code points is the
form U+code_ point, where code_ point is a hexadecimal value. For example, the
code point for “A” is U+0041. Code points range from U+0000 to U+10FFFF.
Each character has one and only one code point.
Free download pdf