MSP430 Microcontroller Basics

I give a few examples of the SD16_A in action. The first input is a straightforward voltage from a potential divider. This is a single-ended signal and I therefore chose differential inputs for the next example. The final case is a cute application to make a self-dimming LED.
Listing 9.10 shows a straightforward program to take a block of independent readings with the SD16_A in a F2003. The circuit is the same as in Figure 9.17a, with a potential divider connected to P1.1. This pin can be used as either A 0- or A 4+ and is routed to the SD16_A by setting the SD16AE.1 bit. The measurement is single-ended rather than differential so I use channel 4 and ground its negative input A 4-. This can be taken from pin P1.2 so I ground it internally by keeping SD16AE.2 clear.
// <i class="emphasis">sd16led3.c - lights LED for high input voltage using SD16A</i>// <i class="emphasis">SD16A channel A4+ on P1.1, A4- int gnd, "single" convs (actually 4)</i>// <i class="emphasis">Store a block of readings for statistical analysis</i>// <i class="emphasis">Homemade analog demo board for MSP430F20xx:</i>// <i class="emphasis">10k on P1.5, 20k variable on P1.6, junction to P1.1 with 10nF cap</i>// <i class="emphasis">100n cap on P1.3 for Vref, LED active...