#include <ioCC2530.h>
//#include <stdio.h>
#define uint unsigned int
#define uchar unsigned char
//定义控制灯的端口
#define RLED P1_0 //定义LED1为P10口控制
#define YLED P1_1 //定义LED2为P11口控制
#define LED3 P1_4
#define LED4 P0_1
/****************************
//延时
*****************************/
void Delay(uint n)
{
uint i,j;
for(i = 0;i<n;i++)
for(j = 110;j>0;j--);
}
/****************************
//初始化程序
*****************************/
void Initial(void)
{
P1DIR |= 0x13; //P10、P11定义为输出
RLED = 1;
YLED = 1; //LED
LED3 = 1 ;
P0DIR |=0x02 ;
LED4 = 1 ;
}
/***************************
//主函数
***************************/
void main(void)
{
Initial(); //调用初始化函数
RLED = 0 ; //LED1
YLED = 0 ; //LED2
LED3 = 0 ;
LED4 = 0 ;
while(1)
{
YLED = !YLED;
Delay(500);
RLED = !RLED;
Delay(500);
LED3 = !LED3;
Delay(500);
LED4 = !LED4;
Delay(500);
}
}