| |
| The assembly language code segment below is to be inserted into the main.asm file that takes an input controlled by a potentionmeter, |
| converts that input to a digital value, and displays that value on the LEDs according to the following: |
|
|
| TABLE 8-1: LED Conditions |
| Value | LEDs Lit |
| $0000 - $3332 | none |
| $3333 - $6665 | 1 |
| $6666 - $9998 | 1,2 |
| $9999 - $CCCB | 1,2,3 |
| $CCCC - $FFFF | 1,2,3,4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| | Org ROMStart |
| Entry: |
| | MOVB #%11110000, DDRB |
| | ldaa #%10000000 |
| | staa ATD0CTL2 |
| | ldaa #%00110100 |
| | staa ATD0CTL5 |
| | LDAA $00 |
|
|
| START | LDD ATD0DR0 |
| | CPD #$3333 |
| | BLO ZERO |
| | CPD #$6666 |
| | BLO ONE |
| | CPD #$9999 |
| | BLO TWO |
| | CPD #$CCCC |
| | BLO THREE |
| | BRA FOUR |
|
|
| FOUR | MOVB #%00000000, PORTB |
| | BRA START |
| | MOVB #%10000000, PORTB |
| | BRA START |
| | MOVB #%11000000, PORTB |
| | BRA START |
| | MOVB #%11100000, PORTB |
| | BRA START |
| | MOVB #%11110000, PORTB |
| | BRA START |
|
|
|
|
| Question: 1. | Carefully comment each line of the program (on your source codes) and explain clearly who it does. |