文件名称:TEST
- 所属分类:
- 微处理器(ARM/PowerPC等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 21kb
- 下载次数:
- 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
....\Debug
....\.....\Exe
....\.....\...\TEST.d43
....\.....\List
....\.....\Obj
....\.....\...\main.r43
....\.....\...\TEST.pbd
....\main.c
....\path.txt
....\settings
....\........\TEST.cspy.bat
....\........\TEST.dbgdt
....\........\TEST.dni
....\........\test.wsdt
....\........\TEST1.wsdt
....\TEST.dep
....\TEST.ewd
....\TEST.ewp
....\test.eww
....\TEST1.eww
....\Debug
....\.....\Exe
....\.....\...\TEST.d43
....\.....\List
....\.....\Obj
....\.....\...\main.r43
....\.....\...\TEST.pbd
....\main.c
....\path.txt
....\settings
....\........\TEST.cspy.bat
....\........\TEST.dbgdt
....\........\TEST.dni
....\........\test.wsdt
....\........\TEST1.wsdt
....\TEST.dep
....\TEST.ewd
....\TEST.ewp
....\test.eww
....\TEST1.eww