Hi,
I just saw your reply on "Using the SD16 of the MSP430 F2013 to measure supply voltage" and it was quite clear. 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 voltage value (variation was large).
////
msp430x20x3_sd16A_01.c
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. Do you have any suggestion for me? If possible, could you email me some instruction? Thank you so much.
Allen (chengyc0314@gmail.com)
Normal 0 0 2 false false false MicrosoftInternetExplorer4 st1\:*{behavior:url(#ieooui) } <!-- /* Font Definitions */ @font-face {font-family:新細明體; panose-1:2 2 3 0 0 0 0 0 0 0; mso-font-alt:PMingLiU; mso-font-charset:136; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:3 137232384 22 0 1048577 0;} @font-face {font-family:"\@新細明體"; panose-1:2 2 3 0 0 0 0 0 0 0; mso-font-charset:136; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:3 137232384 22 0 1048577 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:none; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:新細明體; mso-font-kerning:1.0pt;} p {mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:新細明體; mso-bidi-font-family:新細明體;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> /* Style Definitions */ table.MsoNormalTable {mso-style-name:表格內文; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}
/////////////////////////////
#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){ if (SD16MEM0 < 0x7FFF) // SD16MEM0 > 0.3V?, clears IFG P1OUT &= ~0x01; else P1OUT |= 0x01;}/////////////////////////////////////////////
Normal 0 0 2 false false false MicrosoftInternetExplorer4 <!-- /* Font Definitions */ @font-face {font-family:新細明體; panose-1:2 2 3 0 0 0 0 0 0 0; mso-font-alt:PMingLiU; mso-font-charset:136; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:3 137232384 22 0 1048577 0;} @font-face {font-family:"\@新細明體"; panose-1:2 2 3 0 0 0 0 0 0 0; mso-font-charset:136; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:3 137232384 22 0 1048577 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:none; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:新細明體; mso-font-kerning:1.0pt;} p {mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:新細明體; mso-bidi-font-family:新細明體;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> /* Style Definitions */ table.MsoNormalTable {mso-style-name:表格內文; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}
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. Do you have any suggestion for me? If possible, could you email me some feedback? Thank you so much.
ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". TI AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY TI. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM TI.
Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.