Microchip Technology DM164130-9 用户手册
Lessons
2012 Microchip Technology Inc.
DS41628B-page 59
Now LATC can be assigned to the temporary workspace register, since all of the LEDs
are on pins <RC3:RC0>. The rest of the bits in PORTC can be ignored.
Most of the LEDs will not turn on when the POT is turned clockwise, because the top
four MSbs are being grabbed, meaning that there needs to be a great swing in voltage
change to affect the topmost MSbs. As an added exercise, try using the lower nibble
(bits 0 through 3) and assign them to LATC. The LEDs will change more frequently.
are on pins <RC3:RC0>. The rest of the bits in PORTC can be ignored.
Most of the LEDs will not turn on when the POT is turned clockwise, because the top
four MSbs are being grabbed, meaning that there needs to be a great swing in voltage
change to affect the topmost MSbs. As an added exercise, try using the lower nibble
(bits 0 through 3) and assign them to LATC. The LEDs will change more frequently.
TABLE 3-23:
TEMPORARY WORKSPACE REGISTER AFTER SHIFT
ADRESH – after shift
Bit #
MSb (7)
6
5
4
3
2
1
LSb (0)
value
0
0
0
0
0
1
0
1
ADRESH >> 4; //grab the top 4 MSbs