資源簡介
本設計由STC89C52單片機電路+RFID模塊電路+1602液晶顯示電路+電源電路組成。系統有3張卡,分別代表依次是張三、李四、王二。任何一個人刷卡成功能,1602液晶響應顯示,未刷卡顯示“N”,刷卡成功后顯示“Y”,液晶第二行顯示刷卡人數,即出勤總人數。
附件為C代碼。
代碼片段和文件信息
#include?“1602.h“
#include?“delay.h“
#include?
#define?uchar?unsigned?char
#define?uint?unsigned?int
#define?_NOP()?_nop_()
sbit?RS?=?P2^4;???//定義端口?
sbit?RW?=?P2^5;
sbit?EN?=?P2^6;
#define?DataPort????P0
#define?DataPIN?????P0
#define?CLR_RS?(RS=0)?
#define?SET_RS?(RS=1)
#define?CLR_RW?(RW=0)
#define?SET_RW?(RW=1)
#define?CLR_EN?(EN=0)
#define?SET_EN?(EN=1)
/*
LcdReset();???????????????//LCD1602初始化
DelayMs(10);
sprintf(temp“1111111111111111“);//更新顯示
DispStr(00(unsigned?char?*)temp);//打印顯示
sprintf(temp“1111111111111111“);//更新顯示
DispStr(01(unsigned?char?*)temp);//打印顯示
*/
/***********************************************
函數名稱:DispStr
功????能:讓液晶從某個位置起連續顯示一個字符串
參????數:x--位置的列坐標
??????????y--位置的行坐標
??????????ptr--指向字符串存放位置的指針
返回值??:無
***********************************************/
void?DispStr(uchar?xuchar?yuchar?*ptr)?
{
????uchar?*temp;
????uchar?in?=?0;
????
????temp?=?ptr;
????while(*ptr++?!=?‘\0‘)???n++;????//計算字符串有效字符的個數
????
????for?(i=0;i ????{
????????Disp1Char(x++ytemp[i]);
????????if?(x?==?0x10)
????????{
????????????break;
????????}
????}
}
/*******************************************
函數名稱:DispNchar
功????能:讓液晶從某個位置起連續顯示N個字符
參????數:x--位置的列坐標
??????????y--位置的行坐標
??????????n--字符個數
??????????ptr--指向字符存放位置的指針
返回值??:無
*******************************************
void?DispNChar(uchar?xuchar?y?uchar?nuchar?*ptr)?
{
????uchar?i;
????
????for?(i=0;i ????{
????????Disp1Char(x++yptr[i]);
????????if?(x?==?0x10)
????????{
???????????x?=?0;?
????????????y?^=?1;
????????}
????}
}
*/
/*******************************************
函數名稱:LocateXY
功????能:向液晶輸入顯示字符位置的坐標信息
參????數:x--位置的列坐標
??????????y--位置的行坐標
返回值??:無
********************************************/
void?LocateXY(uchar?xuchar?y)?
{
????uchar?temp;
????temp?=?x&0x0f;
????y?&=?0x01;
????if(y)???temp?|=?0x40;??//如果在第2行
????temp?|=?0x80;
????LcdWriteCommand(temp1);
}
/*******************************************
函數名稱:Disp1Char
功????能:在某個位置顯示一個字符
參????數:x--位置的列坐標
??????????y--位置的行坐標
??????????data--顯示的字符數據
返回值??:無
********************************************/
void?Disp1Char(uchar?xuchar?yuchar?data1)?
{
????LocateXY(?x?y?);
????LcdWriteData(?data1?);
}
/*******************************************
函數名稱:LcdReset
功????能:對1602液晶模塊進行復位操作
參????數:無
返回值??:無
********************************************/
void?LcdReset(void)?
{
//????DataDir??=?0xFF;?????????????????//數據端口設為輸出狀態?
????LcdWriteCommand(0x38?0); ????//規定的復位操作
????DelayMs(5);
????LcdWriteCommand(0x38?0);
????DelayMs(5);
????LcdWriteCommand(0x38?0);
????DelayMs(5);
????LcdWriteCommand(0x38?1); //顯示模式設置
????LcdWriteCommand(0x08?1); //顯示關閉
????LcdWriteCommand(0x01?1); ????//顯示清屏
????LcdWriteCommand(0x06?1); //寫字符時整體不移動
????LcdWriteCommand(0x0c?1); //顯示開,不開游標,不閃爍
}
/*------------------------------------------------
????????????????清屏函數
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-04-10?18:15??2-源程序(C語言含詳細備注)\
?????文件?????????309??2017-06-17?14:42??2-源程序(C語言含詳細備注)\功能.txt
?????目錄???????????0??2020-04-10?18:15??2-源程序(C語言含詳細備注)\程序\
?????文件????????9512??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\1602.LST
?????文件????????9508??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\1602.OBJ
?????文件????????5068??2017-02-18?17:51??2-源程序(C語言含詳細備注)\程序\1602.c
?????文件????????1031??2016-04-04?17:43??2-源程序(C語言含詳細備注)\程序\1602.h
?????文件???????42777??2017-06-17?14:35??2-源程序(C語言含詳細備注)\程序\89c51
?????文件???????40147??2017-06-17?14:35??2-源程序(C語言含詳細備注)\程序\89c51.M51
?????文件???????10204??2017-06-17?14:35??2-源程序(C語言含詳細備注)\程序\89c51.hex
?????文件??????????98??2017-06-17?14:35??2-源程序(C語言含詳細備注)\程序\89c51.lnp
?????文件????????4383??2017-06-17?14:38??2-源程序(C語言含詳細備注)\程序\89c51.plg
?????文件???????57129??2017-06-17?14:38??2-源程序(C語言含詳細備注)\程序\89c51.uvopt
?????文件???????13889??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\89c51.uvproj
?????文件???????57131??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\89c51_uvopt.bak
?????文件???????13563??2017-03-14?15:41??2-源程序(C語言含詳細備注)\程序\89c51_uvproj.bak
?????文件????????6376??2009-05-07?14:37??2-源程序(C語言含詳細備注)\程序\STARTUP.A51
?????文件???????14072??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\STARTUP.LST
?????文件?????????749??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\STARTUP.OBJ
?????文件????????1847??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\delay.LST
?????文件????????1117??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\delay.OBJ
?????文件?????????738??2017-03-12?15:13??2-源程序(C語言含詳細備注)\程序\delay.c
?????文件?????????654??2017-03-12?15:13??2-源程序(C語言含詳細備注)\程序\delay.h
?????文件????????8415??2017-06-17?14:35??2-源程序(C語言含詳細備注)\程序\main.LST
?????文件???????14720??2017-06-17?14:35??2-源程序(C語言含詳細備注)\程序\main.OBJ
?????文件??????????34??2017-06-17?14:35??2-源程序(C語言含詳細備注)\程序\main.__i
?????文件????????3986??2017-06-17?14:35??2-源程序(C語言含詳細備注)\程序\main.c
?????文件???????22098??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\rc522.LST
?????文件???????21195??2017-06-17?14:31??2-源程序(C語言含詳細備注)\程序\rc522.OBJ
?????文件???????14427??2017-06-12?15:16??2-源程序(C語言含詳細備注)\程序\rc522.c
?????文件????????4997??2017-06-12?15:16??2-源程序(C語言含詳細備注)\程序\rc522.h
............此處省略0個文件信息
評論
共有 條評論