Voltage Levels Key Concept
RS232 uses inverted logic levels compared to TTL:
- Logic '0' (Space): +3V to +25V
- Logic '1' (Mark): -3V to -25V
This is important to understand when interfacing RS232 devices with microcontrollers.
Parity Bit Checking
Parity bits are used for basic error detection:
- Even parity: The parity bit is set to ensure an even number of 1s in the data
- Odd parity: The parity bit is set to ensure an odd number of 1s in the data
To check parity:
- Count the number of 1s in the data bits
- For even parity: If count is even, parity bit should be 0; if odd, parity bit should be 1
- For odd parity: If count is odd, parity bit should be 0; if even, parity bit should be 1
Serial Port Communication
Serial communication transmits data one bit at a time over a single wire, plus additional wires for control signals. Key parameters include:
- Baud rate: Speed of transmission (bits per second)
- Data bits: Typically 7 or 8 bits
- Stop bits: Typically 1 or 2 bits
- Parity: None, Even, Odd, Mark, or Space
- Flow control: Hardware (RTS/CTS) or Software (XON/XOFF)