|
效果顯示
213543gnniwq1himnz1lhy.png.thumb.jpg (150.71 KB, 下載次數(shù): 235)
下載附件
2013-6-26 03:54 上傳
- #include
- #include "MacroAndConst.h"
- #include "Led.h"
- #include "Timer.h"
- static uint16 g_u16LedTimeCount = 0 ; //LED 計(jì)數(shù)器
- static uint8 g_u8LedState = 0 ; //LED 狀態(tài)標(biāo)志, 0表示亮,1表示熄滅
- #define LED P0 //定義 LED 接口
- #define LED_ON() LED = 0x00 ; //所有 LED 亮
- #define LED_OFF() LED = 0xff ; //所有 LED 熄滅
- void LedProcess(void)
- {
- if(0 == g_u8LedState) //如果 LED 的狀態(tài)為亮,則點(diǎn)亮 LED
- {
- LED_ON() ;
- }
- else //否則熄滅 LED
- {
- LED_OFF() ;
- }
- }
-
- void LedStateChange(void)
- {
- if(g_bSystemTime1Ms) //系統(tǒng)1MS 時(shí)標(biāo)到
- {
- g_bSystemTime1Ms = 0 ;
- g_u16LedTimeCount++ ; //LED 計(jì)數(shù)器加一
- if(g_u16LedTimeCount >= 500) //計(jì)數(shù)達(dá)到500,即500MS 到了,改變 LED 的狀態(tài)。
- {
- g_u16LedTimeCount = 0 ;
- g_u8LedState = ! g_u8LedState ;
- }
- }
- }
復(fù)制代碼源代碼和仿真文件下載:仿真文件在src文件夾
01 led點(diǎn)陣.rar
(42.53 KB, 下載次數(shù): 63)
2013-6-26 03:52 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
|