|
分享一个msp430FR5969多通道AD采样和串口调试的程序以及12864串口显示程序
[复制链接]
程序说明:依据MSP430FR5969launchpad 开箱程序改编而成。编程环境:IAR6.01
程序有三个部分:1.多通道采集, 主要在FRAMLogMode.C中,中断在主函数中;
2.串口调试,老生常谈,在主函数中;
3.12864串行显示程序;
支持IAR、CCS。
- /*******************************************************************************
- *
- * FRAMLogMode.c
- *
- * MSP430FR5969 wakes up every 5 seconds from LPM3.5 to measure and store its
- * internal temperature sensor & battery monitor data to FRAM
- *
- * June 2014
- * E. Chen
- *
- *revised by James Zhu October.2015 Nankai Universitiy 改编为多通道AD采集程序
- ******************************************************************************/
- #include "main.h"
- #include "driverlib.h"
- #include "LCD12864P.h"//12864的串行写入相关驱动函数
- unsigned long int get0=0,get1=0,get2=0,get3=0,a0=0;
- double a3=0,a1=0,a2=0;
- unsigned long b0[10]={0},b1[10]={0},b2[10]={0},b3[10]={0};
- unsigned int s1=0,s2=0,s3=0,s4=0;
- unsigned int framLog(unsigned int x)
- {
- //Initialize the ADC12B Module
- /*
- * Base address of ADC12B Module
- * Use internal ADC12B bit as sample/hold signal to start conversion
- * USE MODOSC 5MHZ Digital Oscillator as clock source
- * Use default clock divider/pre-divider of 1
- * Use Temperature Sensor and Battery Monitor internal channels
- */
- ADC12_B_initParam initParam = {0};
- initParam.sampleHoldSignalSourceSelect = ADC12_B_SAMPLEHOLDSOURCE_SC;
- initParam.clockSourceSelect = ADC12_B_CLOCKSOURCE_ACLK;
- initParam.clockSourceDivider = ADC12_B_CLOCKDIVIDER_1;
- initParam.clockSourcePredivider = ADC12_B_CLOCKPREDIVIDER__1;
- initParam.internalChannelMap = ADC12_B_NOINTCH;
- //initParam.internalChannelMap = ADC12_B_TEMPSENSEMAP | ADC12_B_BATTMAP;
- ADC12_B_init(ADC12_B_BASE, &initParam);
- //Enable the ADC12B module
- ADC12_B_enable(ADC12_B_BASE);
- // Sets up the sampling timer pulse mode
- ADC12_B_setupSamplingTimer(ADC12_B_BASE,
- ADC12_B_CYCLEHOLD_128_CYCLES,
- ADC12_B_CYCLEHOLD_128_CYCLES,
- ADC12_B_MULTIPLESAMPLESENABLE);
- // Maps Temperature Sensor input channel to Memory 0 and select voltage references
- /*
- * Base address of the ADC12B Module
- * Configure memory buffer 0
- * Map input A2 to memory buffer 0
- * Vref+ = IntBuffer
- * Vref- = AVss
- * Memory buffer 0 is not the end of a sequence
- */
- ADC12_B_configureMemoryParam configureMemoryParam = {0};//初始化,下边配置
- configureMemoryParam.memoryBufferControlIndex = ADC12_B_MEMORY_0;
- configureMemoryParam.inputSourceSelect = ADC12_B_INPUT_A2;//原程序:ADC12_B_INPUT_TCMAP
- configureMemoryParam.refVoltageSourceSelect =
- ADC12_B_VREFPOS_INTBUF_VREFNEG_VSS; //vref+= IntBuffer,Vref- = AVss
- configureMemoryParam.endOfSequence = ADC12_B_NOTENDOFSEQUENCE;//非转换结束通道
- configureMemoryParam.windowComparatorSelect =
- ADC12_B_WINDOW_COMPARATOR_DISABLE;
- configureMemoryParam.differentialModeSelect =
- ADC12_B_DIFFERENTIAL_MODE_DISABLE;//配置完全
- ADC12_B_configureMemory(ADC12_B_BASE, &configureMemoryParam);//configureMemoryParam ADC12_B_MULTIPLESAMPLESENABLE);
- // Maps Temperature Sensor input channel to Memory 0 and select voltage references
- /*
- * Base address of the ADC12B Module
- * Configure memory buffer 0
- * Map input A7 to memory buffer 0
- * Vref+ = IntBuffer
- * Vref- = AVss
- * Memory buffer 0 is not the end of a sequence
- */
- //ADC12_B_configureMemoryParam configureMemoryParam = {0};//初始化,下边配置
- configureMemoryParam.memoryBufferControlIndex = ADC12_B_MEMORY_1;
- configureMemoryParam.inputSourceSelect = ADC12_B_INPUT_A7;//原程序:ADC12_B_INPUT_TCMAP
- configureMemoryParam.refVoltageSourceSelect =
- ADC12_B_VREFPOS_INTBUF_VREFNEG_VSS; //vref+= IntBuffer,Vref- = AVss
- configureMemoryParam.endOfSequence = ADC12_B_NOTENDOFSEQUENCE;//非转换结束通道
- configureMemoryParam.windowComparatorSelect =
- ADC12_B_WINDOW_COMPARATOR_DISABLE;
- configureMemoryParam.differentialModeSelect =
- ADC12_B_DIFFERENTIAL_MODE_DISABLE;//配置完全
- ADC12_B_configureMemory(ADC12_B_BASE, &configureMemoryParam);//configureMemoryParam
- // Maps Temperature Sensor input channel to Memory 0 and select voltage references
- /*
- * Base address of the ADC12B Module
- * Configure memory buffer 0
- * Map input A7 to memory buffer 0
- * Vref+ = IntBuffer
- * Vref- = AVss
- * Memory buffer 0 is not the end of a sequence
- */
- //ADC12_B_configureMemoryParam configureMemoryParam = {0};//初始化,下边配置
- configureMemoryParam.memoryBufferControlIndex = ADC12_B_MEMORY_2;
- configureMemoryParam.inputSourceSelect = ADC12_B_INPUT_A3;//原程序:ADC12_B_INPUT_TCMAP
- configureMemoryParam.refVoltageSourceSelect =
- ADC12_B_VREFPOS_INTBUF_VREFNEG_VSS; //vref+= IntBuffer,Vref- = AVss
- configureMemoryParam.endOfSequence = ADC12_B_NOTENDOFSEQUENCE;//非转换结束通道
- configureMemoryParam.windowComparatorSelect =
- ADC12_B_WINDOW_COMPARATOR_DISABLE;
- configureMemoryParam.differentialModeSelect =
- ADC12_B_DIFFERENTIAL_MODE_DISABLE;//配置完全
- ADC12_B_configureMemory(ADC12_B_BASE, &configureMemoryParam);//configureMemoryParam
- // Maps Battery Monitor input channel to Memory 0 and select voltage references
- /*
- * Base address of the ADC12B Module
- * Configure memory buffer 1
- * Map input A10 to memory buffer 1
- * Vref+ = IntBuffer
- * Vref- = AVss
- * Memory buffer 1 is the end of a sequence
- */
- configureMemoryParam.memoryBufferControlIndex = ADC12_B_MEMORY_3;
- configureMemoryParam.inputSourceSelect = ADC12_B_INPUT_A12;//原程序为:ADC12_B_INPUT_BATMAP
- configureMemoryParam.refVoltageSourceSelect =
- ADC12_B_VREFPOS_INTBUF_VREFNEG_VSS;
- configureMemoryParam.endOfSequence = ADC12_B_ENDOFSEQUENCE;//标志转换结束
- configureMemoryParam.windowComparatorSelect =
- ADC12_B_WINDOW_COMPARATOR_DISABLE;
- configureMemoryParam.differentialModeSelect =
- ADC12_B_DIFFERENTIAL_MODE_DISABLE;
- ADC12_B_configureMemory(ADC12_B_BASE, &configureMemoryParam);
- // Clear memory buffer 0 interrupt
- ADC12_B_clearInterrupt(ADC12_B_BASE,
- 0,
- ADC12_B_IFG3 //ADC12 Memory 1 Interrupt Flag
- );
- // Enable memory buffer 0 interrupt
- ADC12_B_enableInterrupt(ADC12_B_BASE,
- ADC12_B_IE3,//ADC12 Memory 1 Interrupt Enable
- 0,
- 0);
- // Configure internal reference
- while(Ref_A_isRefGenBusy(REF_A_BASE)); // If ref generator busy, WAIT
- Ref_A_enableTempSensor(REF_A_BASE);
- Ref_A_setReferenceVoltage(REF_A_BASE, REF_A_VREF2_5V);
- Ref_A_enableReferenceVoltage(REF_A_BASE);
- // Start timer
- Timer_A_initUpModeParam param = {0};
- param.clockSource = TIMER_A_CLOCKSOURCE_ACLK;
- param.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;
- param.timerPeriod = 13;
- param.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE;
- param.captureCompareInterruptEnable_CCR0_CCIE =
- TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE;
- param.timerClear = TIMER_A_DO_CLEAR;
- param.startTimer = true;
- Timer_A_initUpMode(TIMER_A0_BASE, ¶m);
- __bis_SR_register(LPM3_bits | GIE); // Enter LPM3. Delay for Ref to settle.
- Timer_A_stop(TIMER_A0_BASE);
- //Enable/Start sampling and conversion
- /*
- * Base address of ADC12B Module
- * Start the conversion into memory buffer 0
- * Use the single-channel, single-conversion mode
- */
- ADC12_B_startConversion(ADC12_B_BASE,
- ADC12_B_MEMORY_0,
- ADC12_B_SEQOFCHANNELS);
- __bis_SR_register(LPM3_bits | GIE); // Wait for conversion to complete
- __bic_SR_register(GIE);
- ADC12_B_disable(ADC12_B_BASE);
- //此处可以get转换结果并显示
- get0=ADC12_B_getResults(ADC12_B_BASE, ADC12_B_MEMORY_0);
- get1=ADC12_B_getResults(ADC12_B_BASE, ADC12_B_MEMORY_1);
- get2=ADC12_B_getResults(ADC12_B_BASE, ADC12_B_MEMORY_2);
- get3=ADC12_B_getResults(ADC12_B_BASE, ADC12_B_MEMORY_3);
- if(x==0)
- {
- if(s1==0) //初次进入 清屏
- {
- Ini_Lcd(); s1=s1+1;s2=0;s3=0;s4=0;
- }
- lcd_pos(0,0);
- Disp_HZ("拓扑输出",4); Send(1,':');
- a3=10*2.5*get3/4095;//3000k,30k
- get3=a3*100;
- Disp_SZ(get3/1000);
- Disp_SZ(get3/100%10);
- Send(1,'.');
- Disp_SZ(get3/10%10);
- // Disp_SZ(get3%10);
- Send(1,'V');
-
- lcd_pos(2,2);
- Send(1,'C'); Send(1,'H'); Send(1,'1'); Send(1,':'); //CH1
- get0=2*25*100*get0/4095;//200k,200k
- get0=get0+90;
- a0=get0/1000;
- if(a0)Disp_SZ(a0);
- Send(1,'.');
- Disp_SZ(get0/100%10);
- // Disp_SZ(get0/10%10);
- // Disp_SZ(get0%10);
- Send(1,'V');
-
- lcd_pos(3,2);
- Send(1,'C'); Send(1,'H'); Send(1,'2'); Send(1,':'); //CH2
- get1=3*25*100*get1/4095;//200k,100k
- get1=get1+150;
- Disp_SZ(get1/1000);
- Send(1,'.');
- Disp_SZ(get1/100%10);
- //Disp_SZ(get1/10%10);
- // Disp_SZ(get1%10);
- Send(1,'V');
-
- lcd_pos(4,2);
- Send(1,'C'); Send(1,'H'); Send(1,'3'); Send(1,':'); //CH3
- a2=101*2.5*get2/4095; //3000k,30k
- get2=a2*10;//一个长公式 越界
- Disp_SZ(get2/1000);
- Disp_SZ(get2/100%10);
- Disp_SZ(get2/10%10);
- // Send(1,'.');
- // Disp_SZ(get2%10);
- Send(1,'V');
- }
-
- if(x==1)
- {
- if(s2==0) //初次进入 清屏
- {
- Ini_Lcd(); s2=s2+1;s1=0;s3=0;s4=0;
- }
- lcd_pos(2,2);
- Send(1,'C'); Send(1,'H'); Send(1,'1'); Send(1,':'); //CH1
- get0=2*25*100*get0/4095;//200k,200k
- get0=get0+150;
- a0=get0/1000;
- if(a0)Disp_SZ(a0);
- Send(1,'.');
- Disp_SZ(get0/100%10);
- // Disp_SZ(get0/10%10);
- // Disp_SZ(get0%10);
- Send(1,'V');
-
- lcd_pos(3,2);
- Send(1,'C'); Send(1,'H'); Send(1,'2'); Send(1,':'); //CH2
- get1=3*25*100*get1/4095;//200k,100k
- get1=get1+150;
- Disp_SZ(get1/1000);
- Send(1,'.');
- Disp_SZ(get1/100%10);
- //Disp_SZ(get1/10%10);
- // Disp_SZ(get1%10);
- Send(1,'V');
-
- lcd_pos(4,2);
- Send(1,'C'); Send(1,'H'); Send(1,'3'); Send(1,':'); //CH3
- a2=101*2.5*get2/4095; //3000k,30k
- get2=a2*10;//一个长公式 越界
- Disp_SZ(get2/1000);
- Disp_SZ(get2/100%10);
- Disp_SZ(get2/10%10);
- // Send(1,'.');
- // Disp_SZ(get2%10);
- Send(1,'V');
- }
- if(x==2)
- {
- if(s3==0) //初次进入 清屏
- {
- Ini_Lcd(); s3=s3+1;s1=0;s2=0;s4=0;
- }
- lcd_pos(3,2);
- Send(1,'C'); Send(1,'H'); Send(1,'2'); Send(1,':'); //CH2
- get1=3*25*100*get1/4095;//200k,100k
- get1=get1+150;
- Disp_SZ(get1/1000);
- Send(1,'.');
- Disp_SZ(get1/100%10);
- //Disp_SZ(get1/10%10);
- // Disp_SZ(get1%10);
- Send(1,'V');
-
- lcd_pos(4,2);
- Send(1,'C'); Send(1,'H'); Send(1,'3'); Send(1,':'); //CH3
- a2=101*2.5*get2/4095; //3000k,30k
- get2=a2*10;//一个长公式 越界
- Disp_SZ(get2/1000);
- Disp_SZ(get2/100%10);
- Disp_SZ(get2/10%10);
- // Send(1,'.');
- // Disp_SZ(get2%10);
- Send(1,'V');
- }
- if(x==3)
- {
- if(s4==0) //初次进入 清屏
- {
- Ini_Lcd(); s4=s4+1;s1=0;s2=0;s3=0;
- }
- lcd_pos(4,2);
- Send(1,'C'); Send(1,'H'); Send(1,'3'); Send(1,':'); //CH3
- a2=101*2.5*get2/4095; //3000k,30k
- get2=a2*10;//一个长公式 越界
- Disp_SZ(get2/1000);
- Disp_SZ(get2/100%10);
- Disp_SZ(get2/10%10);
- // Send(1,'.');
- // Disp_SZ(get2%10);
- Send(1,'V');
- }
- return 1;
-
-
- }
复制代码 下面是主程序中的部分:- /*******************************************************************************
- *
- * main.c
- *
- * Out of Box Demo for the MSP-EXP430FR5969
- * Main loop, initialization, and interrupt service routines
- *
- * June 2014
- * E. Chen
- *
- *Revised by James Zhu October.2015 Nankai Universitiy
- ******************************************************************************/
- #include "main.h"
- #include "FRAMLogMode.h"
- #include "driverlib.h"
- #include "LCD12864P.h"//12864的串行写入相关驱动函数
- uint8_t RXData1 = 0, TXData1 = 0,RXData2 = 0, TXData2 = 0;
- uint8_t check1 = 0,check2 = 0,command=0;
- uint8_t t1=0,t2=0;//初次执行函数 清屏
- void Init_Clock()
- {
- // LFXT Setup
- //Set PJ.4 and PJ.5 as Primary Module Function Input.
- /*
- * Select Port J
- * Set Pin 4, 5 to input Primary Module Function, LFXT.
- */
- GPIO_setAsPeripheralModuleFunctionInputPin(
- GPIO_PORT_PJ,
- GPIO_PIN4 + GPIO_PIN5,
- GPIO_PRIMARY_MODULE_FUNCTION
- );
- // Set DCO frequency to 1 MHz
- CS_setDCOFreq(CS_DCORSEL_0, CS_DCOFSEL_0);
- //Set external clock frequency to 32.768 KHz
- CS_setExternalClockSource(32768, 0);
- //Set ACLK=LFXT
- CS_initClockSignal(CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);
- // Set SMCLK = DCO with frequency divider of 1
- CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
- // Set MCLK = DCO with frequency divider of 1
- CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
- //Start XT1 with no time out
- CS_turnOnLFXT(CS_LFXT_DRIVE_0);
- }
- /*
- * UART Communication Initialization
- */
- void Init_UART1()
- {
- // Configure UART pins Set P2.0 and P2.1 as Secondary Module Function Input.
- GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P2,GPIO_PIN0 + GPIO_PIN1,GPIO_SECONDARY_MODULE_FUNCTION);
- //配置传输指示灯
- GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0); //配置P1.0为输出
- GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 ); //配置P1.0输出低
- // Configure UART
- EUSCI_A_UART_initParam param = {0};
- param.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK;
- param.clockPrescalar = 6;
- param.firstModReg = 8;
- param.secondModReg = 0x20;
- param.parity = EUSCI_A_UART_NO_PARITY;
- param.msborLsbFirst = EUSCI_A_UART_LSB_FIRST;
- param.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT;
- param.uartMode = EUSCI_A_UART_MODE;
- param.overSampling = EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION;
-
- if(STATUS_FAIL == EUSCI_A_UART_init(EUSCI_A0_BASE, ¶m))
- return;
- EUSCI_A_UART_enable(EUSCI_A0_BASE);
- EUSCI_A_UART_clearInterrupt(EUSCI_A0_BASE,
- EUSCI_A_UART_RECEIVE_INTERRUPT);
- // Enable USCI_A0 RX interrupt
- EUSCI_A_UART_enableInterrupt(EUSCI_A0_BASE,EUSCI_A_UART_RECEIVE_INTERRUPT); // Enable interrupt
-
- }
- int main(void) {
- // Stop WDT
- WDTCTL = WDTPW + WDTHOLD;
- PMM_unlockLPM5();
- Init_Clock();
- Init_UART1();
- Ini_Lcd();
- __enable_interrupt(); // Enable globale interrupt
- // lcd_pos(0,0);
- // Disp_HZ("串口测试",4);Send(1,':');
- while (1)
- {
- if(check1==1)
- {
- GPIO_toggleOutputOnPin( GPIO_PORT_P1,GPIO_PIN0 ); //翻转P1.0状态
- __delay_cycles( 40 );
- // if(RXData1-0x30<=4)//只有接收到0~4 才能传给command
-
- command=RXData1-0x30;
-
- //TXData1 = RXData1+1;
- // EUSCI_A_UART_transmitData(EUSCI_A0_BASE,TXData1);
-
- check1=0;
-
-
- }
- else
- {
- if(command>=4)
- {
- if(t1==0)//初次进入清屏
- {
- Ini_Lcd(); t1=1;
- }
- lcd_pos(0,0);Disp_HZ("命令超出范围",6);
- lcd_pos(2,0);Disp_HZ("当前命令",4); Send(1,':');Send(1,command+0x30); //进入串口调试模式
- lcd_pos(4,2);Disp_HZ("请输入",3); Send(1,':');Send(1,'0');Send(1,'-');Send(1,'4');//0~4
-
- }
- if(command<4)
- { t1=0; }
-
- framLog(command);
-
-
- }
-
-
-
- __no_operation();
- }
- }
- /*
- * ADC12 Interrupt Service Routine
- * Exits LPM3 when Temperature/Voltage data is ready
- */
- #pragma vector = ADC12_VECTOR
- __interrupt void ADC12_ISR(void)
- {
- switch(__even_in_range(ADC12IV,76))
- {
- case ADC12IV_NONE: break; // Vector 0: No interrupt
- case ADC12IV_ADC12OVIFG: break; // Vector 2: ADC12MEMx Overflow
- case ADC12IV_ADC12TOVIFG: break; // Vector 4: Conversion time overflow
- case ADC12IV_ADC12HIIFG: break; // Vector 6: ADC12HI
- case ADC12IV_ADC12LOIFG: break; // Vector 8: ADC12LO
- case ADC12IV_ADC12INIFG: break; // Vector 10: ADC12IN
- case ADC12IV_ADC12IFG0: // Vector 12: ADC12MEM0
- ADC12IFGR0 &= ~ADC12IFG0; // Clear interrupt flag
- __bic_SR_register_on_exit(LPM3_bits); // Exit active CPU
- break;
- case ADC12IV_ADC12IFG1: // Vector 14: ADC12MEM1
- ADC12IFGR0 &= ~ADC12IFG1; // Clear interrupt flag
- __bic_SR_register_on_exit(LPM3_bits); // Exit active CPU
- break;
- case ADC12IV_ADC12IFG2:
- ADC12IFGR0 &= ~ADC12IFG2; // Clear interrupt flag
- __bic_SR_register_on_exit(LPM3_bits); // Exit active CPU
- break; // Vector 16: ADC12MEM2
- case ADC12IV_ADC12IFG3:ADC12IFGR0 &= ~ADC12IFG3; // Clear interrupt flag
- __bic_SR_register_on_exit(LPM3_bits); // Exit active CPU
- break; // Vector 18: ADC12MEM3
- case ADC12IV_ADC12IFG4: break; // Vector 20: ADC12MEM4
- case ADC12IV_ADC12IFG5: break; // Vector 22: ADC12MEM5
- case ADC12IV_ADC12IFG6: break; // Vector 24: ADC12MEM6
- case ADC12IV_ADC12IFG7: break; // Vector 26: ADC12MEM7
- case ADC12IV_ADC12IFG8: break; // Vector 28: ADC12MEM8
- case ADC12IV_ADC12IFG9: break; // Vector 30: ADC12MEM9
- case ADC12IV_ADC12IFG10: break; // Vector 32: ADC12MEM10
- case ADC12IV_ADC12IFG11: break; // Vector 34: ADC12MEM11
- case ADC12IV_ADC12IFG12: break; // Vector 36: ADC12MEM12
- case ADC12IV_ADC12IFG13: break; // Vector 38: ADC12MEM13
- case ADC12IV_ADC12IFG14: break; // Vector 40: ADC12MEM14
- case ADC12IV_ADC12IFG15: break; // Vector 42: ADC12MEM15
- case ADC12IV_ADC12IFG16: break; // Vector 44: ADC12MEM16
- case ADC12IV_ADC12IFG17: break; // Vector 46: ADC12MEM17
- case ADC12IV_ADC12IFG18: break; // Vector 48: ADC12MEM18
- case ADC12IV_ADC12IFG19: break; // Vector 50: ADC12MEM19
- case ADC12IV_ADC12IFG20: break; // Vector 52: ADC12MEM20
- case ADC12IV_ADC12IFG21: break; // Vector 54: ADC12MEM21
- case ADC12IV_ADC12IFG22: break; // Vector 56: ADC12MEM22
- case ADC12IV_ADC12IFG23: break; // Vector 58: ADC12MEM23
- case ADC12IV_ADC12IFG24: break; // Vector 60: ADC12MEM24
- case ADC12IV_ADC12IFG25: break; // Vector 62: ADC12MEM25
- case ADC12IV_ADC12IFG26: break; // Vector 64: ADC12MEM26
- case ADC12IV_ADC12IFG27: break; // Vector 66: ADC12MEM27
- case ADC12IV_ADC12IFG28: break; // Vector 68: ADC12MEM28
- case ADC12IV_ADC12IFG29: break; // Vector 70: ADC12MEM29
- case ADC12IV_ADC12IFG30: break; // Vector 72: ADC12MEM30
- case ADC12IV_ADC12IFG31: break; // Vector 74: ADC12MEM31
- case ADC12IV_ADC12RDYIFG: break; // Vector 76: ADC12RDY
- default: break;
- }
- }
- /*
- * Timer0_A3 Interrupt Vector (TAIV) handler
- * Used to trigger ADC conversion every 0.125 seconds
- *
- */
- #pragma vector=TIMER0_A0_VECTOR
- __interrupt void TIMER0_A0_ISR(void)
- {
- __bic_SR_register_on_exit(LPM3_bits); // Exit active CPU
- }
- /*
- * USCI_A0 Interrupt Service Routine that receives PC GUI's commands
- */
- #pragma vector = USCI_A0_VECTOR
- __interrupt void USCI_A0_ISR(void)
- {
- switch (__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG)) {
- case USCI_NONE: break;
- case USCI_UART_UCRXIFG:
- RXData1 = EUSCI_A_UART_receiveData(EUSCI_A0_BASE);
- check1 = 1;
- // __bic_SR_register_on_exit(LPM3_bits); // Exit active CPU
- break;
- case USCI_UART_UCTXIFG: break;
- case USCI_UART_UCSTTIFG: break;
- case USCI_UART_UCTXCPTIFG: break;
- }
- }
复制代码
吐血分享,下载务必点赞。。。
|
|