Anyone use this peripheral on a regular basis? I'm using an MSP430F2013 and trying to work out if it's possible to reclaim the -ve input pin for something useful. It seems to me that if I set P1SEL for that pin to GPIO mode, and set the SD16 into unipolar mode, I should be able to use the pin as an I/O, but it doesn't seem to be working properly. I'm not sure if that's because what I'm trying is impossible, or simply that I'm not setting up SD16 properly.
My code is real simple:
P1SEL |= 0x09; // P1.0 = A0+, P1.3 = VREF
SD16AE = SD16AE0; // enable analog input on A0
SD16INCTL0 = SD16INTDLY_0 | SD16GAIN_1 | SD16INCH_0; SD16CTL = SD16XDIV_1 | SD16DIV_1 | SD16SSEL_0 | SD16REFON; SD16CCTL0 = SD16UNI | SD16SNGL | SD16OSR_256 | SD16DF | SD16SC;
// wait for conversion while (!SD16CCTL0 & SD16IFG) { }
sample = SD16MEM0;
Any advice?
(PS: Generic hatred towards TI's documentation, it's so darn difficult to cross-reference. And the SD16 peripheral is particularly hard to understand!).