<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          MSP430的AD使用

          作者: 時間:2016-11-26 來源:網(wǎng)絡(luò) 收藏
          //

          //
          //+-----(0.9766us)--------------------------->+
          //TA0_ISRTA1ADC10_ISRTA0_ISRTA1
          //-----+------------+------------+-----------------+------------+----->
          //Enable ADCTrigger ADCDisable ADC
          //and VrefCompare
          //+-( >30us--->+
          //
          //
          //MSP430G2x33/G2x53
          //-----------------
          ///||XIN|-
          //| || 32kHz
          //--|RSTXOUT|-
          //||
          //>---|P1.7/A7P1.0 |--> LED
          //
          //D. Dang
          //Texas Instruments Inc.
          //December 2010
          //Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10
          //******************************************************************************
          #include"msp430g2553.h"

          本文引用地址:http://www.ex-cimer.com/article/201611/321639.htm

          void main(void)
          {
          WDTCTL = WDTPW + WDTHOLD;// Stop WDT

          ADC10CTL1 = INCH_7 + SHS_1;// P1.7, TA1 trigger sample start
          ADC10AE0 = 0x80;// P1.7 ADC10 option select
          P1DIR |= 0x01;// Set P1.0 to output direction
          TACCTL0 = CCIE;// Enable interrupt
          TACCR0 = 32-1;// PWM Period
          TACCTL1 = OUTMOD_3;// TACCR1 set/reset
          TACCR1 = 2;// TACCR1 PWM Duty Cycle
          TACTL = TASSEL_1 + MC_1;// ACLK, up mode
          __bis_SR_register(LPM3_bits + GIE);// Enter LPM3, enable interrupts
          }

          // ADC10 interrupt service routine
          #pragma vector=ADC10_VECTOR
          __interrupt void ADC10_ISR(void)
          {
          ADC10CTL0 &= ~ENC;// ADC10 disabled
          ADC10CTL0 = 0;// ADC10, Vref disabled completely
          if (ADC10MEM < 0x88)// ADC10MEM = A7 > 0.2V?
          P1OUT &= ~0x01;// Clear P1.0 LED off
          else
          P1OUT |= 0x01;// Set P1.0 LED on
          }

          // Timer A0 interrupt service routine
          #pragma vector=TIMER0_A0_VECTOR
          __interrupt void Timer_A(void)
          {
          ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE;
          ADC10CTL0 |= ENC;// ADC10 enable set
          }



          關(guān)鍵詞: MSP430AD使

          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();