資源簡介
1) 通過實驗掌握 CC2530 芯片 GPIO 的配置方法
2) 掌握 Led 驅動電路及開關 Led 的原理
3) 掌握定時器 T1 的配置與使用
4) 握定時器 T3(8 位)通過中斷方式控制 LED1 周期性閃爍

代碼片段和文件信息
#include?
#define?uint???unsigned??int
#define?uchar??unsigned??char
#define?LED1???P1_0 ????????//定義LED1為P10口控制
#define?LED2???P1_1 ????????//定義LED2為P11口控制
#define?LED3???P0_4 ????????//定義LED3為P04口控制
uint?counter=0; //統計溢出次數
uint?LEDFlag; //標志是否要閃爍
void?InitialT1test(void);???????????????//初始化函數聲明
/****************************
//T1初始化程序
***************************/
void?InitialT1test(void)
{
//初始化LED控制端口P1
P1DIR?=?0x03;? ?????????//P10?P11?為輸出
????????P0DIR?=?0x10;????????????//P04為輸出
????????//燈默認為滅
LED1?=?1;
LED2?=?1;
????????LED3?=?1;
????????
//初始化計數器1
T1CTL?=?0x05;
????????T1STAT=?0x21;??????????//通道0中斷有效8分頻;自動重裝模式(0x0000->0xffff)????????
}
/***************************
//主函數
***************************/
void?main()
{
??InitialT1test();? ?//調用初始化函數
??while(1)??? ?????????//查詢溢出
??{
????if(IRCON?>?0)
????{
??????IRCON?=?0;????????????????//清溢出標志?????
??????counter++;
??????
??????if(counter==15)????????????//中斷計數,約0.25s
??????{
????????counter?=0;
????????LEDFlag?=?!LEDFlag;
??????}
????}
????
????if(LEDFlag)
????{
??????LED2?=??LED1;
??????LED3?=?!LED2;
??????LED1?=?!LED1; ???//?每?1s?LED燈閃爍一下?
??????LEDFlag?=?!LEDFlag;???//?閃爍標志變量置0
????}????????????????
??}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????234362??2015-11-09?15:12??8、CC2530?定時器T3的使用\8.CC2530?定時器T3的使用.pdf
????..A.SH.?????32256??2014-10-21?22:30??8、CC2530?定時器T3的使用\Thumbs.db
?????文件??????22981??2014-09-27?23:04??8、CC2530?定時器T3的使用\Timer\codetab.h
?????文件??????23979??2015-10-30?22:26??8、CC2530?定時器T3的使用\Timer\Debug\Exe\Timer.d51
?????文件??????10958??2015-10-30?22:26??8、CC2530?定時器T3的使用\Timer\Debug\Exe\Timer.hex
?????文件??????81199??2015-10-30?22:26??8、CC2530?定時器T3的使用\Timer\Debug\Obj\main.r51
?????文件????????192??2015-10-30?22:26??8、CC2530?定時器T3的使用\Timer\Debug\Obj\Timer.pbd
?????文件???????6997??2014-09-29?15:52??8、CC2530?定時器T3的使用\Timer\LCD.h
?????文件???????2524??2014-06-12?23:47??8、CC2530?定時器T3的使用\Timer\main.c
?????文件???????1491??2015-10-30?23:07??8、CC2530?定時器T3的使用\Timer\settings\Timer.cspy.bat
?????文件???????3028??2015-10-30?23:24??8、CC2530?定時器T3的使用\Timer\settings\Timer.dbgdt
?????文件???????1002??2015-10-30?23:24??8、CC2530?定時器T3的使用\Timer\settings\Timer.dni
?????文件???????3702??2015-10-30?23:24??8、CC2530?定時器T3的使用\Timer\settings\Timer.wsdt
?????文件???????2226??2015-10-30?23:24??8、CC2530?定時器T3的使用\Timer\Timer.dep
?????文件??????34306??2013-07-05?22:17??8、CC2530?定時器T3的使用\Timer\Timer.ewd
?????文件??????56224??2013-07-05?22:17??8、CC2530?定時器T3的使用\Timer\Timer.ewp
?????文件????????159??2013-07-05?22:17??8、CC2530?定時器T3的使用\Timer\Timer.eww
?????文件?????211762??2015-11-09?15:12??7、CC2530?定時器T1的使用\7.CC2530?定時器T1的使用.pdf
?????文件??????26857??2010-09-03?11:42??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\Backup?of?CC2530T1Test.ewd
?????文件??????53181??2010-09-03?11:42??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\Backup?of?CC2530T1Test.ewp
?????文件???????1401??2014-09-26?00:03??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\CC2530T1Test.c
?????文件???????2969??2015-10-30?22:08??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\CC2530T1Test.dep
?????文件??????34274??2012-09-04?04:45??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\CC2530T1Test.ewd
?????文件??????56256??2014-09-26?00:01??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\CC2530T1Test.ewp
?????文件????????166??2010-09-03?11:42??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\CC2530T1Test.eww
?????文件??????10031??2014-09-26?00:03??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\Debug\Exe\CC2530T1Test.d51
?????文件????????849??2014-09-26?00:03??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\Debug\Exe\CC2530T1Test.HEX
?????文件????????232??2015-10-30?21:33??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\Debug\Obj\CC2530T1Test.pbd
?????文件???????8181??2014-09-26?00:03??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\Debug\Obj\CC2530T1Test.r51
?????文件???????1476??2015-10-30?22:08??7、CC2530?定時器T1的使用\7、CC2530?定時器T1的使用\CC2530T1Test\settings\CC2530T1Test.cspy.bat
............此處省略21個文件信息
評論
共有 條評論