Some commonly used C language control programs for msp430 --- ADC12 (2)

Publisher:CyborgDreamerLatest update time:2016-08-15 Source: eefocusKeywords:msp430  ADC12 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The following is an example of a single-channel, single-shot interrupt mode for ADC12:

//ADC12 single channel single interrupt mode
#include
unsigned ADC_Result;
void ADC12_Init();
void main(){
 WDTCTL = WDTPW + WDTHOLD;
 ADC12_Init();        
 _BIS_SR(GIE);
        ADC12CTL0 |= ADC12SC;
        while(1);
}
//
void ADC12_Init(){
        ADC12CTL0 &= ENC;
 P6DIR &= ~BIT6;
 P6SEL |= BIT6; //Select the second function of P6.6
 ADC12CTL0 = ADC12ON + SHT0_6 + REFON; //Turn on ADC12, you can convert, sample and hold timer 0, usually select 6, 8, turn on the internal reference voltage generator
 ADC12CTL0 &= ~REF2_5V; //Select the internal reference voltage as 1.5V, select
 ADC12CTL1 = SHP + CONSEQ_0 + SHS_0; //Use sampling timer + single channel single conversion mode + sampling input signal source control bit (ADC12SC,).
        ADC12MCTL0 = SREF_1 + INCH_6; //Reference voltage Vref+,AVss.Channel 6
 ADC12IE |= BIT0; //Interrupt enable
        ADC12CTL0 |= ENC; // + ADC12SC; //Conversion enable
}
#pragma vector=ADC_VECTOR
__interrupt void ADC12ISR(){
 ADC_Result = ADC12MEM0; //Here you can observe the value from IAR
        ADC12CTL0 |= ADC12SC;
}

Keywords:msp430  ADC12 Reference address:Some commonly used C language control programs for msp430 --- ADC12 (2)

Previous article:Some commonly used C language control programs for msp430 --- ADC12 (3)
Next article:Some commonly used C language control programs for msp430 --- ADC12 (1)

Recommended ReadingLatest update time:2024-11-15 09:07

MSP430 Learning—CPU and Instructions
MSP430 uses a unified address space allocation;   Word type can only be located at an even address, the even address stores the low byte, and the high byte is located at the address plus 1; Eg. If a byte array is defined and a byte address is assigned to a Word type variable, an error will occur. For example, the
[Microcontroller]
MSP430G2553 outputs ACLK and SMCLK
#include "io430.h" int main( void ) {   int i;   // Stop watchdog timer to prevent time out reset   WDTCTL = WDTPW + WDTHOLD;   P1DIR |= P0 + P4; //Set P1.0 1.4 to output   P1SEL |= P0 + P4; //Set P1.0 to output ACLK, P1.4 to output SMCLK   while(1);   return 0; }
[Microcontroller]
Design of CCD camera dimming photoelectric control system based on MSP430 microcontroller
  1. Introduction   Since the first large-scale theodolite was developed in my country, photography has been the main means of measuring and recording aircraft (missiles, rockets, and spacecraft) with film theodolites. Whether the content recorded by photographic film can be discovered during interpretation is close
[Microcontroller]
Design of CCD camera dimming photoelectric control system based on MSP430 microcontroller
MSP430 capture device is simple and practical
MSP430 Timer A capture pulse example /****************************************************** ****************   //Function: Use the capture function of timer A to measure the pulse width of the pulse signal   //   //   //MSP430F449   // -----------------   // /|\| XIN|-   // | | | 32kHz   //--|RST XOUT|-  
[Microcontroller]
Design of an ultra-low power spatial orientation tester
  0 Preface   Space orientation tester is a widely used electronic measuring instrument. Especially with the development of microelectronics technology, the application of space orientation tester in navigation fields such as vehicles, ships, and aircraft is becoming more and more mature. The space orientation test
[Microcontroller]
Design of an ultra-low power spatial orientation tester
MSP430 MCU Theory Review Knowledge Points
Looking at the development of microprocessors, one is the development towards high-performance computer systems with complex data operations, high-speed communications, information processing and other functions; the other is the emergence of a computer that integrates the central processing unit, memory, I/O interfa
[Microcontroller]
Analysis of SPI data memory expansion based on MSP430F12x2
    1 Introduction     Nowadays, with the rapid development of information industry, embedded systems with microprocessors as the core are playing a huge role in intelligent instruments, real-time control systems, etc. In many practical applications, the problem often faced is the need to support large-capacity data s
[Microcontroller]
A temperature and humidity detection system based on MSP430F1232
Introduction With the development of social economy and the continuous progress of science and technology, the temperature and humidity of the environment need to be limited in many cases. Therefore, temperature and humidity alarms must be installed in certain specific environments for monitoring. To this end, this pa
[Microcontroller]
A temperature and humidity detection system based on MSP430F1232
Latest Microcontroller Articles
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号