文件名称:TEST
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:21.01kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
MCU是msp430g2553,用timerA0控制LED的闪烁,闪烁速度由快到慢,循环执行-
#include "msp430g2553.h"
unsigned char J,K
void main( void )
{
//unsigned char i
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW+ WDTHOLD
P1DIR |= BIT6
/*BCSCTL1 &= ~BIT7
do
{
IFG1 &= ~OFIFG
for(i=0xff i>0 i--)
}
while(IFG1&OFIFG)
BCSCTL2 |= SELS+ DIVS_3 */
CCTL0 |= CCIE
CCR0=65000
TACTL |= TASSEL_2+ MC_1 //+ ID_3
_EINT()
LPM0
}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void key(void)
{
P1OUT ^= BIT6
J++
if(J==16)
{
J=0
K++
if(K==1)
{
TACTL &=~(ID0+ ID1)
TACTL |= ID_0
}
if(K==2)
{
TACTL &=~(ID0+ ID1)
TACTL |= ID_1
}
if(K==3)
{
TACTL &=~(ID0+ ID1)
TACTL |= ID_2
}
if(K==4)
{
TACTL &=~(ID0+ ID1)
TACTL |= ID_3
K=0
}
}
}
#include "msp430g2553.h"
unsigned char J,K
void main( void )
{
//unsigned char i
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW+ WDTHOLD
P1DIR |= BIT6
/*BCSCTL1 &= ~BIT7
do
{
IFG1 &= ~OFIFG
for(i=0xff i>0 i--)
}
while(IFG1&OFIFG)
BCSCTL2 |= SELS+ DIVS_3 */
CCTL0 |= CCIE
CCR0=65000
TACTL |= TASSEL_2+ MC_1 //+ ID_3
_EINT()
LPM0
}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void key(void)
{
P1OUT ^= BIT6
J++
if(J==16)
{
J=0
K++
if(K==1)
{
TACTL &=~(ID0+ ID1)
TACTL |= ID_0
}
if(K==2)
{
TACTL &=~(ID0+ ID1)
TACTL |= ID_1
}
if(K==3)
{
TACTL &=~(ID0+ ID1)
TACTL |= ID_2
}
if(K==4)
{
TACTL &=~(ID0+ ID1)
TACTL |= ID_3
K=0
}
}
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
TEST/
TEST/Debug/
TEST/Debug/Exe/
TEST/Debug/Exe/TEST.d43
TEST/Debug/List/
TEST/Debug/Obj/
TEST/Debug/Obj/main.r43
TEST/Debug/Obj/TEST.pbd
TEST/main.c
TEST/path.txt
TEST/settings/
TEST/settings/TEST.cspy.bat
TEST/settings/TEST.dbgdt
TEST/settings/TEST.dni
TEST/settings/test.wsdt
TEST/settings/TEST1.wsdt
TEST/TEST.dep
TEST/TEST.ewd
TEST/TEST.ewp
TEST/test.eww
TEST/TEST1.eww
TEST/Debug/
TEST/Debug/Exe/
TEST/Debug/Exe/TEST.d43
TEST/Debug/List/
TEST/Debug/Obj/
TEST/Debug/Obj/main.r43
TEST/Debug/Obj/TEST.pbd
TEST/main.c
TEST/path.txt
TEST/settings/
TEST/settings/TEST.cspy.bat
TEST/settings/TEST.dbgdt
TEST/settings/TEST.dni
TEST/settings/test.wsdt
TEST/settings/TEST1.wsdt
TEST/TEST.dep
TEST/TEST.ewd
TEST/TEST.ewp
TEST/test.eww
TEST/TEST1.eww
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.