level 1
这个猛男不太猛
楼主
#include<ioCC2530.h>
void initt1()
{
T1CTL=0x00;
T1CC0H=0x00;
T1CC0L=0x7d;
T1CTL=0x0e;//128分频,模模式。
// T1CTL=0x0d;//128分频,自动重装 0X0000-0XFFFF
T1STAT=0x21;//通道0, 中断有效
} static unsigned int count=0;
#define Bell P2_0 //Bell为P2.0口控制
#define Blue_LED P1_4 //P14连接蓝色LED
#define Yellow_LED1 P1_5 //P15连接黄色LED
#define Yellow_LED2 P1_6 //P16连接黄色LED
void Initial_IO(void)
{
//P1DIR = 0x10; //P1_4定义为输出
P1DIR = 0xff; //P1定义为输出
P2DIR = 0x00; //P2_0 为输出
P1=0x00; //P1口为低,禁止所有LED
// Bell=0; //禁止蜂鸣器
} void main( void )
{
Initial_IO();
initt1(); while(1)
{
if(IRCON>0)
{
IRCON=0;
if(++count>1000)//自由运行时为1 ;
{
Blue_LED=!Blue_LED;
count=0;
}
}
}
2013年07月06日 04点07分
1
void initt1()
{
T1CTL=0x00;
T1CC0H=0x00;
T1CC0L=0x7d;
T1CTL=0x0e;//128分频,模模式。
// T1CTL=0x0d;//128分频,自动重装 0X0000-0XFFFF
T1STAT=0x21;//通道0, 中断有效
} static unsigned int count=0;
#define Bell P2_0 //Bell为P2.0口控制
#define Blue_LED P1_4 //P14连接蓝色LED
#define Yellow_LED1 P1_5 //P15连接黄色LED
#define Yellow_LED2 P1_6 //P16连接黄色LED
void Initial_IO(void)
{
//P1DIR = 0x10; //P1_4定义为输出
P1DIR = 0xff; //P1定义为输出
P2DIR = 0x00; //P2_0 为输出
P1=0x00; //P1口为低,禁止所有LED
// Bell=0; //禁止蜂鸣器
} void main( void )
{
Initial_IO();
initt1(); while(1)
{
if(IRCON>0)
{
IRCON=0;
if(++count>1000)//自由运行时为1 ;
{
Blue_LED=!Blue_LED;
count=0;
}
}
}