Logic Lab
Binary Codes
ASCII and EBCDIC side by side, plus parity error detection with a working XOR-gate checker.
ASCII, EBCDIC and error detection
| Char | ASCII hex | ASCII binary (7 bit) | EBCDIC hex | EBCDIC binary | Parity bit |
|---|---|---|---|---|---|
| H | 48 | 1001000 | C8 | 11001000 | 0 |
| i | 69 | 1101001 | 89 | 10001001 | 0 |
| ␣ | 20 | 0100000 | 40 | 01000000 | 1 |
| 5 | 35 | 0110101 | F5 | 11110101 | 0 |
ASCII uses 7 bits (128 characters). EBCDIC is IBM’s 8-bit code, where letters come in three separate runs (A–I, J–R, S–Z) instead of one. Only plain ASCII characters are listed here.
Parity check on “H”
The sender adds a parity bit (leftmost) so the number of 1s is even. Tap bits to damage the word in transit.
Parity checker made from XOR gates
Each XOR gate adds two bits without a carry, so the last gate outputs the parity of all eight bits. For even parity the word is good when that parity is 0, so Error = 1 means an odd number of 1s. The sender uses the same tree over the seven data bits to make the parity bit.
Nothing damaged.
A single parity bit detects any odd number of flipped bits and misses any even number. It detects but does not correct. Hamming codes add several parity bits so the position of a single error can be found.