利用范例学习MSP430中。
本来设置的RTC已能正常工作,删除了些程序后时钟快了很多。开中断后,程序只能进入中断,不能再顺序执行。
检查没有发现额外设置时钟的语句。只用了一次设置时钟语句。
。。。。。
Init_GPIO();
Init_Clock();
Init_RTC();
Init_LCD();
ADC_Init();
DisplayAll( );
__enable_interrupt();
Delay_mS( 300 );
Init_Clock();
Init_RTC();
Init_LCD();
ADC_Init();
DisplayAll( );
__enable_interrupt();
Delay_mS( 300 );
‘。。。。。。。
void Init_Clock()
{
// Intializes the XT1 crystal oscillator
CS_turnOnXT1( CS_XT1_DRIVE_1 );
}
/*
* Real Time Clock counter Initialization
*/
void Init_RTC()
{
// Set RTC modulo to 327-1 to trigger interrupt every ~10 ms
RTC_setModulo( RTC_BASE, 326 );
RTC_enableInterrupt( RTC_BASE, RTC_OVERFLOW_INTERRUPT );
RTC_start( RTC_BASE, RTC_CLOCKSOURCE_XT1CLK );
Time_Cnt = 0;
RTC_Cnt = 0;
}
{
// Intializes the XT1 crystal oscillator
CS_turnOnXT1( CS_XT1_DRIVE_1 );
}
/*
* Real Time Clock counter Initialization
*/
void Init_RTC()
{
// Set RTC modulo to 327-1 to trigger interrupt every ~10 ms
RTC_setModulo( RTC_BASE, 326 );
RTC_enableInterrupt( RTC_BASE, RTC_OVERFLOW_INTERRUPT );
RTC_start( RTC_BASE, RTC_CLOCKSOURCE_XT1CLK );
Time_Cnt = 0;
RTC_Cnt = 0;
}
只能执行到 __enable_interrupt();
请大侠帮忙。