Hello all,
I was involved in a project which need to use the SD16 module in EZ430_f2013 USB stick. However, when I practiced the code example "msp430x20x3_sd16A_01.c" (as shown below) and downloaded it into my EZ430 stick, I could not get stable SD16MEM0 value (variation was large)./////////////////////////////////////#include <msp430x20x3.h>void main(void){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 to output direction SD16CTL = SD16REFON + SD16SSEL_1; // 1.2V ref, SMCLK SD16INCTL0 = SD16INCH_1; // A1+/- SD16CCTL0 = SD16UNI + SD16IE; // 256OSR, unipolar, interrupt enable //SD16AE = SD16AE2; // P1.1 A1+, A1- = VSS SD16AE = SD16AE2 + SD16AE3; SD16CCTL0 |= SD16SC; // Set bit to start conversion _BIS_SR(LPM0_bits + GIE);}#pragma vector = SD16_VECTOR__interrupt void SD16ISR(void) // I set a break point here{ if (SD16MEM0 < 0x7FFF) // SD16MEM0 > 0.3V?, clears IFG P1OUT &= ~0x01; else P1OUT |= 0x01;}///////////////////////////////////////////
In this example, I think the SD16 can only sense 0v to 0.6volt (please correct me if I am wrong). Therefore, I set up a simple example in which I used a DC supply, 0.6 volt connecting with a series of resistors R1 (1KOhm) and R2 ( 2KOhm) to GND; I fed the R2 voltage (0.4v) and GND into my EZ430 input hole P4 and P5 respectively. When I set a break point in "__interrupt void SD16ISR(void) " and press GO, the SD16MEM0 value I got from each break was not the same, and the value varied from 30000 to 40000. I also thought the SD16MEM0 of 0.6V should be 65535, but I still got an unstable result. Does anyone have any suggestion?
Thank you all.
Hi,
there are some posts in the forum covering the SD16, i.e.
http://e2e.ti.com/forums/p/8234/32191.aspx#32191http://e2e.ti.com/forums/p/3130/22113.aspx#22113
The contain a lot of useful information on how to setup/use the SD16 peripheral.RgdsaBUGSworstnightmare
Thanks a lot~~ [:Y]