郭天祥MSP430教程源码-WatchDog.zip
时间:10-27 14:35
查看:1153次
下载:162次
简介:
有关郭天祥MSP430教程源码-WatchDog实验程序。
#include <msp430x14x.h>
#include "BoardConfig.h"
void main(void)
{
BoardConfig(0xbf); //关闭数码管、流水灯和电平转换
WDTCTL = WDT_MDLY_32; // Set Watchdog Timer interval to ~30ms
IE1 |= WDTIE; // Enable WDT interrupt
P3DIR |= BIT4; // Set P3.4 to output direction
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
}
// Watchdog Timer interrupt service routine
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
{
P3OUT ^= BIT4; // Toggle P3.4 using exclusive-OR
}