?? lcdshow.c
字號(hào):
//********************** 使用 Lcd 硬件 工作 通信 ****************
#include "msp430x14x.h"
#include "main.h"
//********************** extern 區(qū)****************extern 區(qū)****************
//********************** extern 區(qū)****************extern 區(qū)****************
//form main.c
//用作為 16 個(gè)位!BOOLEAN 變量來(lái)使用
extern unsigned int g_intMark;
extern unsigned int g_intMarkA;
extern unsigned char g_chSecond, g_chMinute, g_chHour, g_chDay, g_chMonth, g_chYear;
extern unsigned int intTBCount_50ms;
//from lcd.c
extern unsigned char g_chLcdDriveBuf[33];
extern unsigned char g_chLcdDriveHead;
extern unsigned char g_chLcdDriveTail;
extern unsigned char g_chLcdDrive_Stat;
//from debug.c
extern unsigned int g_int135Ver;
////////////////////////////////////////////////
//from innerComm.c
extern unsigned char g_chFS_Status;
extern unsigned char g_chFS_SelfCheck_Status;
extern unsigned char g_chGP_SelfCheck_Status;
extern unsigned char g_chGP_Status;
extern unsigned char g_chCable_Status;
extern unsigned int g_intGP_Current[8];
extern unsigned int g_intGP_FixedCurrent[8];
//from env.c
extern unsigned char g_chEnv_Free;
extern unsigned char g_chEnv_Status;//-按位表明1-2通道的環(huán)境的告警/恢復(fù)狀態(tài)
//3--5位為三路環(huán)境模擬量(溫度1,48V,有害氣體):
//6位為門(mén)禁,
//7位為溫度2 剩下一個(gè)可以以后擴(kuò)展
//溫度
extern unsigned char g_chTemperature;
extern unsigned char g_chTemperatureBoard;
//門(mén)
extern unsigned char g_chDoorStat;//0-門(mén)關(guān) 1-密碼開(kāi)門(mén) 2-非法開(kāi)門(mén) 3-中心開(kāi)門(mén) 4-禁用門(mén)禁 5-啟用 6-門(mén)開(kāi)
extern unsigned char g_chOpenDoorID[3];//記錄開(kāi)門(mén)人,保留的是索引號(hào)
//2 個(gè) A/D 處理
extern unsigned char g_chDC;
extern unsigned char g_chBadGas;
//********************** extern 區(qū)****************extern 區(qū)****************
//********************** extern 區(qū)****************extern 區(qū)****************
//********************** const 區(qū)****************const 區(qū)****************
//********************** const 區(qū)****************const 區(qū)****************
const unsigned char chInitiativeReport_0[] = "正在等待135 啟動(dòng)";
const unsigned char chInitiativeReport_1[] = "局有無(wú)DTMF模塊";
const unsigned char chInitiativeReport_2[] = "主動(dòng)報(bào)告方式:";
const unsigned char chInitiativeReport_2_1[] = "無(wú)DTMF模塊";
const unsigned char chInitiativeReport_2_2[] = "無(wú)中心號(hào)碼";
//
const unsigned char chInitiativeReport_10[] = "無(wú)活動(dòng)告警";
//
const unsigned char chActiveAlert_20[] = "活動(dòng)告警 共05條";
const unsigned char chActiveAlert_23[] = "配線架第";//xx01列
const unsigned char chActiveAlert_21_1[] = "列";
const unsigned char chActiveAlert_120[] = "未設(shè)置門(mén)禁系統(tǒng)";
const unsigned char chActiveAlert_120_1[] = "用戶開(kāi)門(mén)非法開(kāi)門(mén)中心開(kāi)門(mén)";
const unsigned char chActiveAlert_120_2[] = "門(mén)開(kāi)門(mén)關(guān)禁用";
const unsigned char chActiveAlert_121[] = "溫度01度";
const unsigned char chActiveAlert_122[] = "直流電壓伏";
const unsigned char chActiveAlert_123[] = "有害氣體";
const unsigned char chActiveAlert_124[] = "強(qiáng)電固有值";
const unsigned char chActiveAlert_24[] = "信號(hào)線第";//
const unsigned char chActiveAlert_21[] = "工頻設(shè)備第";//05工頻設(shè)備第01列
//const unsigned char chActiveAlert_22[] = "信號(hào)線第";//04強(qiáng)電01列9999mA
const unsigned char chActiveAlert_25[] = "主干電纜第";//02主干電纜第01列
const unsigned char chActiveAlert_8[] = "消音鍵壞自校驗(yàn)鍵壞";//02主干電纜第01列
//********************** const 區(qū)****************const 區(qū)****************
//********************** const 區(qū)****************const 區(qū)****************
void MainLcdProcess(void);
unsigned char g_chMainLcdProcess_Stat;
unsigned char g_chMainLcdProcess_1s;
unsigned char g_chIndex;
unsigned char g_chBit;
unsigned char AlertSum(void);
void ProcessKeyStoke(void);
void ProcessKeyStoke(void)
{
if(g_intMarkA & KeyStokeGood_MarkA)
{
//表明按紐OK
}
else
{
return;
}
if(P6IN & NOspeak)
{//NOspeak BIT7 //P6.7--J2.4---Speak按鍵控制端,低有效
//高,沒(méi)有動(dòng)作
}
else
{///有動(dòng)作
g_chBit = 8;
}
if(P1IN & CHEK)
{//CHEK BIT2 //CHEK----P1.2,自檢按鍵控制端,常態(tài)為高,低有效
//高,沒(méi)有動(dòng)作
}
else
{///有動(dòng)作
if(g_chMainLcdProcess_Stat < 120)
{
g_chMainLcdProcess_Stat = 120;
}
}
}
/**************************************
*功能: 查詢活動(dòng)告警的數(shù)量
*參數(shù):
*返回:
*備注:
**************************************/
unsigned char AlertSum(void)
{
unsigned char chSum = 0;
unsigned char chI;
for(chI = 0; chI < 8; chI++)
{//對(duì)各種。。。按位來(lái)處理
if(g_chFS_Status & (1 << chI))
{
chSum++;
}
if(g_chFS_SelfCheck_Status & (1 << chI))
{
chSum++;
}
if(g_chGP_SelfCheck_Status & (1 << chI))
{
chSum++;
}
if(g_chGP_Status & (1 << chI))
{
chSum++;
}
if(g_chCable_Status & (1 << chI))
{
chSum++;
}
}
//環(huán)境只用到 7 個(gè)
for(chI = 0; chI < 7; chI++)
{//對(duì)各種。。。按位來(lái)處理
if(g_chEnv_Free & (1 << chI))
{
//no
}
else
{
if(g_chEnv_Status & (1 << chI))
{
chSum++;
}
}
}
return(chSum);
}
/**************************************
*功能: LCD 顯示應(yīng)用層,負(fù)責(zé)寫(xiě)入緩沖中的信息
*參數(shù):
*返回:
*備注: 實(shí)時(shí)運(yùn)行
**************************************/
void MainLcdProcess(void)
{
if((g_chLcdDriveTail == 0) || (g_chLcdDriveTail == 16))//---no
{//當(dāng)緩沖區(qū)里的信息 為空的時(shí)候才可以來(lái)處理發(fā)送新的信息
unsigned char chI;
g_chMainLcdProcess_1s = 0;
switch(g_chMainLcdProcess_Stat)
{
case 0:
//等待 135 正常
if(intTBCount_50ms > 10)
{
if(g_int135Ver > 0)
{
g_chMainLcdProcess_Stat = 1;
}
else
{
for(chI = 0; chI < 16; chI++)
{
g_chLcdDriveBuf[1 + chI] = chInitiativeReport_0[chI];
}
g_chLcdDriveTail = 32;
}
}
break;
//1---10 顯示開(kāi)機(jī)信息,不必特別控制顯示時(shí)間!
case 1:
//局及版本信息
//第一行 局號(hào)
for(chI = 0; chI < 4; chI++)
{
g_chLcdDriveBuf[1 + chI] = *(unsigned char *)(StationID_Info + chI);
}
g_chLcdDriveBuf[5] = chInitiativeReport_1[0];
g_chLcdDriveBuf[6] = chInitiativeReport_1[1];
if(g_intMark & HaveDTMFModule_Mark)
{//有
g_chLcdDriveBuf[7] = chInitiativeReport_1[2];
g_chLcdDriveBuf[8] = chInitiativeReport_1[3];
}
else
{//無(wú)
g_chLcdDriveBuf[7] = chInitiativeReport_1[4];
g_chLcdDriveBuf[8] = chInitiativeReport_1[5];
}
for(chI = 0; chI < 8; chI++)
{
g_chLcdDriveBuf[9 + chI] = chInitiativeReport_1[chI + 6];
}
//第二行 版本號(hào)
if(g_int135Ver % 10 == 1)
{//版本相同
g_chLcdDriveBuf[22] = 'V';
g_chLcdDriveBuf[23] = Ver_ID0;
g_chLcdDriveBuf[24] = '.';
g_chLcdDriveBuf[25] = Ver_ID1;
g_chLcdDriveBuf[26] = Ver_ID2;
}
else
{//版本不相同
g_chLcdDriveBuf[19] = 'V';
g_chLcdDriveBuf[20] = Ver_ID0;
g_chLcdDriveBuf[21] = '.';
g_chLcdDriveBuf[22] = Ver_ID1;
g_chLcdDriveBuf[23] = Ver_ID2;
g_chLcdDriveBuf[27] = 'V';
g_chLcdDriveBuf[28] = (g_int135Ver / 1000) % 10 + 48;
g_chLcdDriveBuf[29] = '.';
g_chLcdDriveBuf[30] = (g_int135Ver / 100) % 10 + 48;;
g_chLcdDriveBuf[31] = (g_int135Ver / 10) % 10 + 48;;
}
g_chLcdDriveTail = 32;
g_chMainLcdProcess_Stat = 2;
break;
case 2:
// 主動(dòng)報(bào)告方式
//第一行 主動(dòng)報(bào)告方式: chInitiativeReport_1
for(chI = 0; chI < 13; chI++)
{
g_chLcdDriveBuf[3 + chI] = chInitiativeReport_2[chI];
}
//第二行 DTMFxx無(wú)中心號(hào)碼 DTMFxx無(wú)模塊 DTMFxxxxxxxxxx56 RS232xxx4800xxxx
if(*(unsigned char *)(CommMode_Info) == '1')
{//DTMF
g_chLcdDriveBuf[17] = 'D';
g_chLcdDriveBuf[18] = 'T';
g_chLcdDriveBuf[19] = 'M';
g_chLcdDriveBuf[20] = 'F';
if(g_intMark & HaveDTMFModule_Mark)
{//有
if(g_intMarkA & DTMFCallCenter_MarkA)
{//有
for(chI = 0; chI < 12; chI++)
{
g_chLcdDriveBuf[21 + chI] = *(unsigned char *)(DesTeleID_Info + chI + 6);
}
for(chI = 0; chI < 12; chI++)
{
if(g_chLcdDriveBuf[21 + chI] == '9')
{
g_chLcdDriveBuf[21 + chI] = ' ';
}
else
{
break;
}
}
}
else
{//無(wú)
for(chI = 0; chI < 10; chI++)
{
g_chLcdDriveBuf[23 + chI] = chInitiativeReport_2_2[chI];
}
}
}
else
{//無(wú) 無(wú)DTMF模塊
for(chI = 0; chI < 10; chI++)
{
g_chLcdDriveBuf[23 + chI] = chInitiativeReport_2_1[chI];
}
}
}
else
{//RS232
g_chLcdDriveBuf[17] = 'R';
g_chLcdDriveBuf[18] = 'S';
g_chLcdDriveBuf[19] = '2';
g_chLcdDriveBuf[20] = '3';
g_chLcdDriveBuf[21] = '2';
g_chLcdDriveBuf[31] = '0';
g_chLcdDriveBuf[32] = '0';
if(*(unsigned char *)(CommMode_Info) == '2')
{//9600
g_chLcdDriveBuf[29] = '9';
g_chLcdDriveBuf[30] = '6';
}
else if(*(unsigned char *)(CommMode_Info) == '4')
{//2400
g_chLcdDriveBuf[29] = '2';
g_chLcdDriveBuf[30] = '4';
}
else
{//4800
g_chLcdDriveBuf[29] = '4';
g_chLcdDriveBuf[30] = '8';
}
}
g_chLcdDriveTail = 32;
g_chMainLcdProcess_Stat = 10;//--------no
break;
case 8://顯示按鍵壞
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -