Interface four common anode sevensegment LEDs to the PIC18F4
Interface four common anode seven-segment LEDs to the PIC18F452 microcontroller using PORTB and PORTC. Write instructions to display a four-digit number stored in data registers starting from REG20 (address 20H).
Solution
instructions
STA
LDA
LHLD
SHLD
MOV A, X
| Binary | Octal | Decimal | Hexadecimal |
|---|---|---|---|
| 0000 | 0 | 0 | 0 |
| 0001 | 1 | 1 | 1 |
| 0010 | 2 | 2 | 2 |
| 0011 | 3 | 3 | 3 |
| 0100 | 4 | 4 | 4 |
| 0101 | 5 | 5 | 5 |
| 0110 | 6 | 6 | 6 |
| 0111 | 7 | 7 | 7 |
| 1000 | 10 | 8 | 8 |
| 1001 | 11 | 9 | 9 |
| 1010 | 12 | 10 | A |
| 1011 | 13 | 11 | B |
| 1100 | 14 | 12 | C |
| 1101 | 15 | 13 | D |
| 1110 | 16 | 14 | E |
| 1111 | 17 | 15 | F |
