|
CA24064B (T6963c)keilc51示例程序
// CA24064 //*************************************************************************** //* Create by :Ssmart 2004/12/01 KeilC V7.0 * //*************************************************************************** //連線表: CPU=89C52 * //C/D=P2.0 /CE=P2.7 FS=P3.5 /WR=/WR /RD=/RD * //FOSC=12MHz D0-D7=P0.0-P0.7 /RSET=/(CPU RSET) * //*************************************************************************** #include <reg52.h> #include <intrins.h> #include <stdio.h>
#define uint unsigned int #define uchar unsigned char #define Graphic 1 #define TXT 0 #define LcmLengthDots 240 #define LcmWidthDots 64
char xdata LcmDataPort _at_ 0x0000; char xdata LcmCmdPort _at_ 0x0100; sbit FS = P3^5; sbit Key= P3^4;
uchar code bmp1[]; uchar code str1[];
//指令&數(shù)據(jù)讀寫狀態(tài) void CheckRWCD(void) { while((LcmCmdPort & 0x03) != 0x03); //低電平忙 } //數(shù)據(jù)自動(dòng)寫狀態(tài) void CheckAutoWrite(void) { while((LcmCmdPort & 0x08) == 0); //低電平忙 } //屏讀/屏考貝出錯(cuò)狀態(tài) void CheckScreen(void) { while(LcmCmdPort & 0x40); //1出錯(cuò),0正確 } //一個(gè)數(shù)據(jù)子寫入函數(shù) void LcmWriteData(uchar uData) { LcmDataPort = uData; } //一個(gè)數(shù)據(jù)讀出函數(shù) uchar LcmReadData( void ) { uchar uData; uData = LcmDataPort; return uData; } //無(wú)參數(shù)指令寫入函數(shù) void LcmWriteCommand(uchar Command) { CheckRWCD(); //檢測(cè)指令讀寫狀態(tài) LcmCmdPort = Command;
|