MSP430G2553官方示例:软件定时器与中断

5星 · 超过95%的资源 需积分: 50 63 下载量 79 浏览量 更新于2024-07-27 收藏 76KB DOC 举报
本文档提供了针对 MSP430G2553单片机的两个官方例程,适用于Texas Instruments (TI)的LaunchPad开发板。这两个示例旨在展示如何利用该芯片的不同功能,并且未进行任何修改,旨在供2012年TI杯电子设计大赛参与者参考。 第一个例程是"LaunchPadLab2-SoftwareToggleP1.0",它主要用于实现定时器功能和GPIO操作。首先,程序设置了一个停止单元(Watchdog Timer),通过`WDTCTL`寄存器来确保系统稳定性。接着,检查了时钟源校准常数是否正确,如果发现不准确,则进入无限循环等待校准。在配置基础时钟后,将P1.0引脚设置为输出模式,驱动一个LED。程序通过`_delay_cycles`函数实现了LED的交替亮灭,通过软件方式模拟定时器中断。 第二个例程名为"LaunchPadLab3-SoftwarePortInterruptService",它关注中断处理和GPIO输入/输出。在这个例子中,主要展示了如何使用软件中断服务子程序(Software Port Interrupt Service Routine),即通过编程控制的方式响应GPIO引脚的状态变化。具体来说,它设置了P1.6引脚作为中断源,当该引脚状态改变时,程序会进入中断服务函数处理。这部分代码演示了如何使用中断机制来简化任务调度和提高代码的灵活性。 这些例程向开发者展示了如何在MSP430G2553单片机上实现基本的定时、中断管理和GPIO操作,是初学者理解和实践MSP430平台编程的良好起点。理解并掌握这些核心功能对于构建基于MSP430的硬件项目至关重要,包括但不限于嵌入式系统的定时器应用、用户界面控制以及故障检测等场景。
2020-05-08 上传
官方例程,包含uart,iic,ad10等具体例子。msp430g2x13_ca_01.c Comp_A, Output Reference Voltages on P1.1 msp430g2x13_ca_02.c Comp_A, Detect Threshold, Set P1.0 if P1.1 > 0.25*Vcc msp430g2x13_ca_03.c Comp_A, Simple 2.2V Low Battery Detect msp430g2x33_adc10_01.c ADC10, Sample A0, Set P1.0 if A0 > 0.5*AVcc msp430g2x33_adc10_02.c ADC10, Sample A1, 1.5V Ref, Set P1.0 if A1 > 0.2V msp430g2x33_adc10_03.c ADC10, ADC10, Sample A10 Temp, Set P1.0 if Temp ++ ~2C msp430g2x33_adc10_04.c ADC10, ADC10, Sample A1, Signed, Set P1.0 if A1 > 0.5*AVcc msp430g2x33_adc10_05.c ADC10, ADC10, Sample A11, Lo_Batt, Set P1.0 if AVcc 0.5V msp430g2x33_adc10_12.c ADC10, Sample A7, 1.5V, TA1 Trig, Ultra-Low Pwr msp430g2x33_adc10_13.c ADC10, DTC Sample A1 32x, AVcc, TA0 Trig, DCO msp430g2x33_adc10_14.c ADC10, DTC Sample A1-0 16x, AVcc, Repeat Seq, DCO msp430g2x33_adc10_16.c ADC10, ADC10, DTC Sample A0 -> TA1, AVcc, DCO msp430g2x33_adc10_temp.c ADC10, Sample A10 Temp and Convert to oC and oF msp430g2xx3_1.c Software Toggle P1.0 msp430g2xx3_1_vlo.c Software Toggle P1.0, MCLK = VLO/8 msp430g2xx3_clks.c Basic Clock, Output Buffered SMCLK, ACLK and MCLK/10 msp430g2xx3_dco_calib.c Basic Clock with preloaded DCO calibration constants msp430g2xx3_dco_flashcal.c DCO Calibration Constants Programmer msp430g2xx3_flashwrite_01.c Flash In-System Programming, Copy SegC to SegD msp430g2xx3_LFxtal_nmi.c LFXT1 Oscillator Fault Detection msp430g2xx3_lpm3.c Basic Clock, LPM3 Using WDT ISR, 32kHz ACLK msp430g2xx3_lpm3_vlo.c Basic Clock, LPM3 Using WDT ISR, VLO ACLK msp430g2xx3_nmi.c Basic Clock, Configure RST/NMI as NMI msp430g2xx3_P1_01.c Software Poll P1.4, Set P1.0 if P1.4 = 1 msp430g2xx3_P1_02.c Software Port Interrupt Service on P1.4 from LPM4 msp430g2xx3_P1_03.c Poll P1 With Software with Internal Pull-up msp430g2xx3_P1_04.c P1 Interrupt from LPM4 with Internal Pull-up msp430g2xx3_pinosc_01.c Capacitive Touch, Pin Oscillator Method, 1 button msp430g2xx3_pinosc_02.c Capacitive Touch, Pin Oscillator Method, 4-buttons msp430g2xx3_pinosc_03.c Capacitive Touch, Pin Oscillator Method, 4-buttons, ACLK for CCR msp430g2xx3_pinosc_04.c Capacitive Touch, Pin Oscillator Method, 8 buttons, UART msp430g2xx3_ta_01.c Timer_A, Toggle P1.0, CCR0 Cont. Mode ISR, DCO SMCLK msp430g2xx3_ta_02.c Timer_A, Toggle P1.0, CCR0 Up Mode ISR, DCO SMCLK msp430g2xx3_ta_03.c Timer_A, Toggle P1.0, Overflow ISR, DCO SMCLK msp430g2xx3_ta_04.c Timer_A, Toggle P1.0, Overflow ISR, 32kHz ACLK msp430g2xx3_ta_05.c Timer_A, Toggle P1.0, CCR0 Up Mode ISR, 32kHz ACLK msp430g2xx3_ta_06.c Timer_A, Toggle P1.0, CCR1 Cont. Mode ISR, DCO SMCLK msp430g2xx3_ta_07.c Timer_A, Toggle P1.0-2, Cont. Mode ISR, DCO SMCLK msp430g2xx3_ta_08.c Timer_A, Toggle P1.0-2, Cont. Mode ISR, 32kHz ACLK msp430g2xx3_ta_10.c Timer_A, Toggle P1.1/TA0, Up Mode, DCO SMCLK msp430g2xx3_ta_11.c Timer_A, Toggle P1.1/TA0, Up Mode, 32kHz ACLK msp430g2xx3_ta_13.c Timer_A, Toggle P1.1/TA0, Up/Down Mode, DCO SMCLK msp430g2xx3_ta_14.c Timer_A, Toggle P1.1/TA0, Up/Down Mode, 32kHz ACLK msp430g2xx3_ta_16.c Timer_A, PWM TA1-2, Up Mode, DCO SMCLK msp430g2xx3_ta_17.c