AD usage of MSP430

Publisher:陈熙琼Latest update time:2015-10-16 Source: eefocusKeywords:MSP430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
//

//
//                    +-----(0.9766us)---------\------------------>+
//    TA0_ISR        TA1      ADC10_ISR             TA0_ISR        TA1
//  -----+------------+------------+-----------\------+------------+----->
//   Enable ADC    Trigger ADC  Disable ADC
//   and Vref                   Compare
//       +-( >30us--->+
//
//
//               MSP430G2x33/G2x53
//            -----------------
//        /||              XIN|-
//         | |                 | 32kHz
//         --|RST          XOUT|-
//           |                 |
//       >---|P1.7/A7     P1.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"

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
}

Keywords:MSP430 Reference address:AD usage of MSP430

Previous article:MSP430 failed to initialize using BSL program
Next article:MSP430 interrupt program

Recommended ReadingLatest update time:2024-11-17 05:59

MSP430 failed to initialize using BSL program
When I first started using MSP430, I encountered a problem when I burned the program into the development board. The BSL initialization always failed. Consider the reason 1. Is the program for burning into the board correct?   2. Are the BSL part and the part of the microcontroller that needs to be connected w
[Microcontroller]
MSP430 and PCF8576 driver (you can learn from the usage of IIC)
  #i nclude "msp430x14x.h" #define uint unsigned int #define uchar unsigned char #define Num_of_Results 8 unsigned int results ; uchar PCF8576=0x70;//Device address //Memory data definition uchar ByteCnt; //I2C data byte counter uchar SlvAdr; //Slave address uchar SubAdr; //Slav
[Microcontroller]
Summary of using MSP430 timer interrupt!
I have been studying the timer of MSP430 for the past two days and found it quite troublesome. Here I record my learning experience: There is only TIMER A interrupt on MSP430G2211, so here we discuss TIMER A, TIMER B should be similar to TIMER A. For each timer, it has two interrupts, TIMERA0_VECTOR and TIMERA1_VECTOR.
[Microcontroller]
Design of high-precision electronic balance based on MSP430F4250
Introduction With the rapid development of modern electronic technology and microcomputer technology, electronic balances have been applied to the field of balances. Since the first electronic balance appeared in the world in the late 1970s, in just over 30 years, a series of electronic balances with various s
[Microcontroller]
Design of high-precision electronic balance based on MSP430F4250
The function of the TEST pin of msp430
1602 has 8 data lines and three control lines (E enable line, R/W read/write line, RS indicates data or instruction) Generally, write the address first and then write the data. DS18b20 is a single-wire device. Data is transmitted one bit at a time on the line. After writing a command to DS18b20, the temperature v
[Microcontroller]
Design of a heat meter based on ultra-low power microprocessor MSP430
introduction my country has a vast territory and a large population. The scale of housing construction is huge, and the amount of residential construction is large and wide. It is still on the rise, and this upward trend will continue for 20 to 30 years. In this case, changing the "big pot" heating pa
[Microcontroller]
Design of a heat meter based on ultra-low power microprocessor MSP430
DES encryption program based on msp430 microcontroller
I was asked to do something about microcontrollers before. Because I didn't know much about microcontroller programming, I learned some knowledge by myself and wrote a program. Among them, the clock is also written according to the delay of the for loop. If you have a better code, please tell me. Its main function
[Microcontroller]
Hardware Design of ARINC429 Bus Communication Based on MSP430 MCU
ARINC429 aviation communication bus is a commonly used inertial navigation system communication bus. As the functions of the bus are relatively independent, avionics systems are gradually becoming integrated, and data communication between subsystems has become more frequent. Therefore, developing a handheld device bas
[Microcontroller]
Hardware Design of ARINC429 Bus Communication Based on MSP430 MCU
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号