1 / 9

第九章 MSP430 的 ACD 模組

第九章 MSP430 的 ACD 模組. ADC 簡介. 取樣 (sampling). 類比 Analog  continuous. 數位 Digital discrete (discontinuous). ADC 簡介. ADC 簡介. 12-Bit ADC Core. Ex. 當 V R- = 0V, V R+ = 2.5V, 若 Vin= 1V 時, N ADC = ? . ADC_01.C. 以電源供應器供給固定電壓,並觀察 ADC12MEM0 暫存器內容. ADC_01.C. ADC_01.C. V REF =3.3V. ADC_02.C.

velika
Download Presentation

第九章 MSP430 的 ACD 模組

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第九章MSP430的ACD模組

  2. ADC簡介 • 取樣(sampling) • 類比Analog continuous • 數位Digitaldiscrete (discontinuous)

  3. ADC簡介

  4. ADC簡介

  5. 12-Bit ADC Core • Ex. 當VR-=0V, VR+=2.5V, 若Vin=1V時,NADC= ?

  6. ADC_01.C • 以電源供應器供給固定電壓,並觀察ADC12MEM0暫存器內容

  7. ADC_01.C

  8. ADC_01.C • VREF=3.3V

  9. ADC_02.C void main(void) { WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer P6SEL |= 0x01; // Enable A/D channel A0 ADC12CTL0 = ADC12ON+SHT0_2; // Turn on ADC12, set sampling time ADC12CTL1 = SHP; // Use sampling timer ADC12CTL0 |= ENC; // Enable conversions P1DIR |= 0x0f; while (1) { ADC12CTL0 |= ADC12SC; // Start conversion while ((ADC12IFG & BIT0)==0); // Check ADC interrupt flag if(ADC12MEM0>620) if(ADC12MEM0>1241) if(ADC12MEM0>1861) if(ADC12MEM0>2482) P1OUT = 0x00; // Vin > 2.0Volt 4 LED else P1OUT = 0x08; // 2.0Volt > Vin > 1.5Volt 3 LED else P1OUT = 0x0C; // 1.5Volt > Vin > 1.0Volt 2 LED else P1OUT = 0x0E; // 1.0Volt > Vin > 0.5Volt 1 LED else P1OUT = 0x0F; // 0.5Volt > Vin 0 LED } } • VREF=3.3V利用ADC的功能,偵測由電源供應器輸入電壓大小,並反映至LED燈的點亮數目。

More Related