?? trafficlight.h
字號(hào):
#ifndef __TRAFFICLIGHT_H__
#define __TRAFFICLIGHT_H__
// write your header here
unsigned int ui_Cnt = 1;
unsigned int uiRet = 0;
unsigned int uiFlash_Flag = 0; //閃爍時(shí)顯示綠燈還是熄滅的標(biāo)志
unsigned int uiQuarterSecondCnt = 0; //0.25秒計(jì)數(shù)器
int uiShowCnt = 20; //數(shù)碼管倒計(jì)時(shí)顯示值
unsigned int uiShi = 0; //數(shù)碼管顯示的十位
unsigned int uiGe = 0; //數(shù)碼管顯示的個(gè)位
unsigned int uiE_2ColorLED = 0; //東方向雙色LED要顯示的數(shù)(紅綠黃燈)
unsigned int uiW_2ColorLED = 0; //西方向雙色LED要顯示的數(shù)(紅綠黃燈)
unsigned int uiS_2ColorLED = 0; //南方向雙色LED要顯示的數(shù)(紅綠黃燈)
unsigned int uiN_2ColorLED = 0; //北方向雙色LED要顯示的數(shù)(紅綠黃燈)
unsigned int uiStatus; //整個(gè)系統(tǒng)運(yùn)行狀態(tài)
unsigned int uiStatus_Normal; //正常運(yùn)行狀態(tài)下的子狀態(tài)
unsigned int uiKey; //鍵值
unsigned int ui_SN_RedLight = 20; //南北紅燈時(shí)間設(shè)置值
unsigned int ui_SN_GreenLight = 20; //南北綠燈時(shí)間設(shè)置值
unsigned int uiEastCnt = 0; //往東車流量
unsigned int uiWeastCnt = 0; //往西車流量
unsigned int uiSouthCnt = 0; //往南車流量
unsigned int uiNorthCnt = 0; //往北車流量
unsigned int uiEastCnt_L = 0; //來自東邊左轉(zhuǎn)車流量
unsigned int uiEastCnt_S = 0; //來自東邊直行車流量
unsigned int uiEastCnt_R = 0; //來自東邊右轉(zhuǎn)車流量
unsigned int uiWeastCnt_L = 0; //來自西邊左轉(zhuǎn)車流量
unsigned int uiWeastCnt_S = 0; //來自西邊直行車流量
unsigned int uiWeastCnt_R = 0; //來自西邊右轉(zhuǎn)車流量
unsigned int uiSouthCnt_L = 0; //來自南邊左轉(zhuǎn)車流量
unsigned int uiSouthCnt_S = 0; //來自南邊直行車流量
unsigned int uiSouthCnt_R = 0; //來自南邊右轉(zhuǎn)車流量
unsigned int uiNorthCnt_L = 0; //來自北邊左轉(zhuǎn)車流量
unsigned int uiNorthCnt_S = 0; //來自北邊直行車流量
unsigned int uiNorthCnt_R = 0; //來自北邊右轉(zhuǎn)車流量
unsigned int g_uiResetIO = 0;
#define C_FlashTime 16 //開始閃爍的剩余時(shí)間
#define C_YellowTime 8 //開始變黃燈的剩余時(shí)間
//系統(tǒng)狀態(tài)定義
#define C_Status_Normal 1 //正常運(yùn)行狀態(tài)
#define C_Status_Emergency 2 //緊急狀態(tài)
#define C_Status_Setup 3 //設(shè)置狀態(tài)
#define C_Status_Query 4 //查詢狀態(tài)
//片選端的定義
//&&&
#define CS0 0xfffe // 選通東邊的雙色LED
#define CS1 0xfffd // 選通南邊的雙色LED
#define CS2 0xfffb // 選通西邊的雙色LED
#define CS3 0xfff7 // 選通北邊的雙色LED
//|||
#define CS4 0x0010 // 選通數(shù)碼管個(gè)位
#define CS5 0x0020 // 選通數(shù)碼管十位
//雙色LED定義
#define C_ALL_Red 0xaa00
//&&&
#define C_Left_Green 0xfe0f
#define C_Left_Red 0xfd0f
#define C_Left_Yellow 0xfc0f
//|||
#define C_Left_Close 0x010f
//&&&
#define C_Straight_Green 0xfb0f
#define C_Straight_Red 0xf70f
#define C_Straight_Yellow 0xf30f
//|||
#define C_Straight_Close 0x040f
//&&&
#define C_Right_Green 0xef0f
#define C_Right_Red 0xdf0f
#define C_Right_Yellow 0xcf0f
//|||
#define C_Right_Close 0x100f
//&&&
#define C_Pavement_Green 0xbf0f
#define C_Pavement_Red 0x7f0f
#define C_Pavement_Yellow 0x3f0f
//|||
#define C_Pavement_Close 0x400f
//正常運(yùn)行下的幾種子狀態(tài)
//1南邊車道左轉(zhuǎn)彎綠燈,南邊車道直行綠燈,北邊車道右轉(zhuǎn)彎綠燈,西邊車道右轉(zhuǎn)彎綠燈,東邊人行道綠燈,其它為紅燈
#define C_1_Green 1
#define C_1_S_Green (C_Left_Green&C_Straight_Green&C_Right_Red&C_Pavement_Red)&CS1
#define C_1_N_Green (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS3
#define C_1_E_Green (C_Left_Red&C_Straight_Red&C_Right_Red&C_Pavement_Green)&CS0
#define C_1_W_Green (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS2
//2南邊車道左轉(zhuǎn)彎綠燈閃爍,南邊車道直行綠燈閃爍,北邊車道右轉(zhuǎn)彎綠燈閃爍,西邊車道右轉(zhuǎn)彎綠燈,東邊人行道綠燈閃爍,其它為紅燈
#define C_1_Flash 2
#define C_1_S_Flash (C_Right_Red&C_Pavement_Red)|(C_Left_Close|C_Straight_Close)&CS1
#define C_1_N_Flash (C_Left_Red&C_Straight_Red&C_Pavement_Red)|(C_Right_Close)&CS3
#define C_1_E_Flash (C_Left_Red&C_Straight_Red&C_Right_Red)|(C_Pavement_Close)&CS0
#define C_1_W_Flash (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS2
//3南邊車道左轉(zhuǎn)彎黃燈,南邊車道直行黃燈,北邊車道右轉(zhuǎn)彎黃燈,西邊車道右轉(zhuǎn)彎綠燈,東邊人行道黃燈,其它為紅燈
#define C_1_Yellow 3
#define C_1_S_Yellow (C_Left_Yellow&C_Straight_Yellow&C_Right_Red&C_Pavement_Red)&CS1
#define C_1_N_Yellow (C_Left_Red&C_Straight_Red&C_Right_Yellow&C_Pavement_Red)&CS3
#define C_1_E_Yellow (C_Left_Red&C_Straight_Red&C_Right_Red&C_Pavement_Yellow)&CS0
#define C_1_W_Yellow (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS2
//4東邊車道左轉(zhuǎn)彎綠燈,東邊車道直行綠燈,西邊車道右轉(zhuǎn)彎綠燈,南邊車道右轉(zhuǎn)彎綠燈,北邊人行道綠燈,其它為紅燈
#define C_2_Green 4
#define C_2_S_Green (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS1
#define C_2_N_Green (C_Left_Red&C_Straight_Red&C_Right_Red&C_Pavement_Green)&CS3
#define C_2_E_Green (C_Left_Green&C_Straight_Green&C_Right_Red&C_Pavement_Red)&CS0
#define C_2_W_Green (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS2
//5東邊車道左轉(zhuǎn)彎綠燈閃爍,東邊車道直行綠燈閃爍,西邊車道右轉(zhuǎn)彎綠燈閃爍,南邊車道右轉(zhuǎn)彎綠燈,北邊人行道綠燈閃爍,其它為紅燈
#define C_2_Flash 5
#define C_2_S_Flash (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS1
#define C_2_N_Flash (C_Left_Red&C_Straight_Red&C_Right_Red)|(C_Pavement_Close)&CS3
#define C_2_E_Flash (C_Right_Red&C_Pavement_Red)|(C_Left_Close|C_Straight_Close)&CS0
#define C_2_W_Flash (C_Left_Red&C_Straight_Red&C_Pavement_Red)|(C_Right_Close)&CS2
//6東邊車道左轉(zhuǎn)彎黃燈,東邊車道直行黃燈,西邊車道右轉(zhuǎn)彎黃燈,南邊車道右轉(zhuǎn)彎綠燈,北邊人行道黃燈,其它為紅燈
#define C_2_Yellow 6
#define C_2_S_Yellow (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS1
#define C_2_N_Yellow (C_Left_Red&C_Straight_Red&C_Right_Red&C_Pavement_Yellow)&CS3
#define C_2_E_Yellow (C_Left_Yellow&C_Straight_Yellow&C_Right_Red&C_Pavement_Red)&CS0
#define C_2_W_Yellow (C_Left_Red&C_Straight_Red&C_Right_Yellow&C_Pavement_Red)&CS2
//7北邊車道左轉(zhuǎn)彎綠燈,北邊車道直行綠燈,南邊車道右轉(zhuǎn)彎綠燈,東邊車道右轉(zhuǎn)彎綠燈,西邊人行道綠燈,其它為紅燈
#define C_3_Green 7
#define C_3_S_Green (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS1
#define C_3_N_Green (C_Left_Green&C_Straight_Green&C_Right_Red&C_Pavement_Red)&CS3
#define C_3_E_Green (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS0
#define C_3_W_Green (C_Left_Red&C_Straight_Red&C_Right_Red&C_Pavement_Green)&CS2
//8北邊車道左轉(zhuǎn)彎綠燈閃爍,北邊車道直行綠燈閃爍,南邊車道右轉(zhuǎn)彎綠燈閃爍,東邊車道右轉(zhuǎn)彎綠燈,西邊人行道綠燈閃爍,其它為紅燈
#define C_3_Flash 8
#define C_3_S_Flash (C_Left_Red&C_Straight_Red&C_Pavement_Red)|(C_Right_Close)&CS1
#define C_3_N_Flash (C_Right_Red&C_Pavement_Red)|(C_Left_Close|C_Straight_Close)&CS3
#define C_3_E_Flash (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS0
#define C_3_W_Flash (C_Left_Red&C_Straight_Red&C_Right_Red)|(C_Pavement_Close)&CS2
//9北邊車道左轉(zhuǎn)彎黃燈,北邊車道直行黃燈,南邊車道右轉(zhuǎn)彎黃燈,東邊車道右轉(zhuǎn)彎綠燈,西邊人行道黃燈,其它為紅燈
#define C_3_Yellow 9
#define C_3_S_Yellow (C_Left_Red&C_Straight_Red&C_Right_Yellow&C_Pavement_Red)&CS1
#define C_3_N_Yellow (C_Left_Yellow&C_Straight_Yellow&C_Right_Red&C_Pavement_Red)&CS3
#define C_3_E_Yellow (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS0
#define C_3_W_Yellow (C_Left_Red&C_Straight_Red&C_Right_Red&C_Pavement_Yellow)&CS2
//10西邊車道左轉(zhuǎn)彎綠燈閃爍,西邊車道直行綠燈閃爍,東邊車道右轉(zhuǎn)彎綠燈閃爍,北邊車道右轉(zhuǎn)彎綠燈,南邊人行道綠燈閃爍,其它為紅燈
#define C_4_Green 10
#define C_4_S_Green (C_Left_Red&C_Straight_Red&C_Right_Red&C_Pavement_Green)&CS1
#define C_4_N_Green (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS3
#define C_4_E_Green (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS0
#define C_4_W_Green (C_Left_Green&C_Straight_Green&C_Right_Red&C_Pavement_Red)&CS2
//11西邊車道左轉(zhuǎn)彎綠燈,西邊車道直行綠燈,東邊車道右轉(zhuǎn)彎綠燈,北邊車道右轉(zhuǎn)彎綠燈,南邊人行道綠燈,其它為紅燈
#define C_4_Flash 11
#define C_4_S_Flash (C_Left_Red&C_Straight_Red&C_Right_Red)|(C_Pavement_Close)&CS1
#define C_4_N_Flash (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS3
#define C_4_E_Flash (C_Left_Red&C_Straight_Red&C_Pavement_Red)|(C_Right_Close)&CS0
#define C_4_W_Flash (C_Right_Red&C_Pavement_Red)|(C_Left_Close|C_Straight_Close)&CS2
//12西邊車道左轉(zhuǎn)彎黃燈,西邊車道直行黃燈,東邊車道右轉(zhuǎn)彎黃燈,北邊車道右轉(zhuǎn)彎綠燈,南邊人行道黃燈,其它為紅燈
#define C_4_Yellow 12
#define C_4_S_Yellow (C_Left_Red&C_Straight_Red&C_Right_Red&C_Pavement_Yellow)&CS1
#define C_4_N_Yellow (C_Left_Red&C_Straight_Red&C_Right_Green&C_Pavement_Red)&CS3
#define C_4_E_Yellow (C_Left_Red&C_Straight_Red&C_Right_Yellow&C_Pavement_Red)&CS0
#define C_4_W_Yellow (C_Left_Yellow&C_Straight_Yellow&C_Right_Red&C_Pavement_Red)&CS2
//語音資源定義
#define C_0 0 // 語音資源: 0
#define C_1 1 // 語音資源: 1
#define C_2 2 // 語音資源: 2
#define C_3 3 // 語音資源: 3
#define C_4 4 // 語音資源: 4
#define C_5 5 // 語音資源: 5
#define C_6 6 // 語音資源: 6
#define C_7 7 // 語音資源: 7
#define C_8 8 // 語音資源: 8
#define C_9 9 // 語音資源: 9
#define C_10 10 // 語音資源: 十
#define C_ZHUYI 11 // 語音資源: 注意
#define C_WANG 12 // 語音資源: 往
#define C_DONG 13 // 語音資源: 東
#define C_XI 14 // 語音資源: 西
#define C_NAN 15 // 語音資源: 南
#define C_BEI 16 // 語音資源: 北
#define C_ZOU 17 // 語音資源: 走
#define C_DE 18 // 語音資源: 的
#define C_CHELIULIANG 19 // 語音資源: 車流量
#define C_SHI 20 // 語音資源: 是
#define C_LIANG 21 // 語音資源: 輛
#define C_SouthNorth 22 // 語音資源: 現(xiàn)在南北方向通行,請(qǐng)注意
#define C_EastWeast 23 // 語音資源: 現(xiàn)在東西方向通行,請(qǐng)注意
#define C_JINGDI 24 // 語音資源: 警笛聲
#define C_HuanXiang 25 // 語音資源: 換向時(shí)的提示音
//鍵值的定義
#define C_Key1 0x0001
#define C_Key2 0x0002
#define C_Key3 0x0004
#define C_W_L 0x0010
#define C_W_S 0x0020
#define C_W_R 0x0040
#define C_E_L 0x0080
#define C_E_S 0x0100
#define C_E_R 0x0200
#define C_N_L 0x0400
#define C_N_S 0x0800
#define C_N_R 0x1000
#define C_S_L 0x2000
#define C_S_S 0x4000
#define C_S_R 0x8000
void PlayS480(int Index);
void Play2Number(unsigned int uiNumber,unsigned int uiDirection);
void Run_Normal(void);
void Run_Emergency(void);
void Run_Setup(void);
void Run_Query(void);
void ShowControl(void);
unsigned int GetKeyValue(void);
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -