?? main.c
字號:
#include <AT89X52.H>
#include "macro.h"
#include "common.h"
#include "28F040.h"
#include "HT1380.h"
#include "lcd.h"
#include "serial.h"
#include "key.h"
#include "idcard.h"
#include "menu.h"
void main(void)
{
BYTE i;
EA=0;
PSW=0;
P0=P1=P2=P3=0xFF;
Ret_I();
Ret_I();
TMOD=0x11; // T0=16bit T1=8bit auto reload
TCON=0x45; // Timer1 start
PCON=0x00; // SMOD=0
SCON=0x50; // UART_mode=1,REN=1
T2MOD=0;
T2CON=0x34; // Set T2 to baud rate register
AUX_OUT_OFF
Serial_init();
Protect_28F040();
Unprotect_28F040();
LCD_open();
VOC_stop();
BELL_OFF
Calc_Total_User();
Calc_Total_Record();
Sys_Stat=SB;
LCD_ShowStatus();
IP=0x10; // Set Serial to high level
IE=0x98; // Enable Serial and Timer1 interrupt
while(1){
if(b_Recv_done)
Recv_Process();
if(0==Timer_20ms){ // 20ms * 50 = 1s
if(Timer_1s)
Timer_1s--;
Timer_20ms=50;
if(Menu_stat==0){
LCD_ShowRiqi();
LCD_ShowTime();
if(!b_LCD_line4){ // LCD line 4 control by Machine
b_ShowNow=!b_ShowNow;
if(b_ShowNow){
b_ShowSomething=!b_ShowSomething;
if(b_ShowSomething){
#ifdef CHINESE
// mystrcpy(" 恒 創 科 技 ");
mystrcpy(" 金 典 科 技 ");
// mystrcpy(" 江蘇海通通信 ");
#else
mystrcpy("WeWin Technology");
#endif
LCD_writeline(6);
}else{
#ifdef CHINESE
mystrcpy(" 管 理 創 效 益 ");
#else
mystrcpy("Time Attendance ");
#endif
LCD_writeline(6);
}
}
}
}
}
if((0==Timer_20ms2)&&(b_20ms2==0)){
b_20ms2=1;
if(Total_Record<30000)
#ifdef CHINESE
mystrcpy(" 請 刷 卡 ");
#else
mystrcpy(" Check the Card ");
#endif
else
#ifdef CHINESE
mystrcpy(" 考勤記錄將滿 ");
#else
mystrcpy("Too Much Records");
#endif
LCD_writeline(4);
}
if(Pause_time==0){
i=Check_Key_Card_valid(3);
if(i==0xFF){ // ID_Card input
for(i=0; i<7; i++){
if(Last_Card_no[i]!=ID_Card_no[i]){
i=100;
break;
}
}
if(i!=100){ // The same card
if(Timer_1s){
Timer_1s=4;
continue;
}
}
Card_Process();
}else if(i!=0){ // Key_in
Key_Process(i);
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -