STC89C52單片機12864液晶顯示
///////////////////////////////////////////////////////////////////////
#include
#define uchar unsigned char
#define uint unsigned int
#define Lcd_IO P0
#define Commd 0
#define Data 1
sbit LCDRS=P3^4;
sbit LCDRW=P3^5;
sbit LCDEN=P3^6;
sbit LCDPSB=P3^7;
sbit wei=P2^7;
sbit duan=P2^6;
//一幅公雞圖形數(shù)據(jù)
uchar code Lcd_num[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x70,0x00,0x70,0xC0,0x02,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x70,0x00,0x70,0xC0,0x0F,0x03,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xF8,0x00,0x70,0xC0,0xFF,0x83,0x00,0xC0,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xE8,0x03,0xFE,0xC0,0x1C,0x03,0x03,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0xCC,0x00,0x70,0xC0,0x1C,0x33,0x04,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0xC7,0x00,0x76,0xDC,0x1C,0x33,0x08,0x00,0x01,0x00,0x00,0x00,0xE0,0x30,0x00,
0x03,0x87,0x87,0x7F,0xFC,0x1C,0x33,0x18,0x06,0x0C,0xE0,0x00,0x00,0xC0,0x30,0x00,
0x07,0x03,0xF7,0xFF,0xFC,0xFF,0xB3,0x10,0x06,0x1D,0xC0,0x00,0x00,0xC0,0x30,0x00,
0x0C,0x01,0xE7,0xFE,0xDC,0xFF,0xB3,0x20,0x0E,0x3A,0xF0,0x00,0x00,0xC0,0x70,0x00,
0x1F,0xFF,0xE7,0x0E,0xDC,0x1C,0x33,0x20,0x0E,0x31,0xD0,0x00,0x01,0xC0,0x70,0x00,
0x2F,0xFF,0xA3,0x04,0xDC,0x3C,0x33,0x20,0x0E,0x70,0x60,0x00,0x01,0xC0,0x70,0x00,
0x00,0x70,0x03,0xFC,0xDC,0x3E,0x33,0x40,0x0C,0xE0,0x00,0x00,0x01,0xC0,0x60,0x00,
0x00,0x70,0x00,0x18,0xDC,0x3F,0x33,0x40,0x0C,0xC1,0x9F,0xC3,0xD9,0xBC,0x6E,0x1C,
0x00,0x70,0x00,0x70,0xDC,0x3F,0x33,0x40,0x1D,0x81,0x9F,0xE7,0xF9,0xFC,0x6E,0x18,
0x1F,0xFF,0xE0,0xF2,0xDC,0x7F,0x33,0x40,0x1F,0x81,0x98,0xE7,0x39,0x8E,0xE6,0x38,
0x1F,0xFF,0xE0,0x76,0xDC,0x7D,0x33,0x40,0x1F,0x03,0x98,0xEE,0x33,0x8E,0xE6,0x30,
0x08,0x70,0x00,0x7C,0xDC,0x5C,0x33,0x20,0x1F,0x83,0xB8,0xCE,0x33,0x8C,0xE6,0x30,
0x0C,0x71,0x87,0xF8,0xDC,0xDC,0x33,0x20,0x1B,0x83,0x38,0xCE,0x33,0x0C,0xC6,0x60,
0x06,0x71,0x07,0xF1,0xDC,0x9C,0x33,0x20,0x19,0x83,0x38,0xCC,0x33,0x0C,0xC6,0x60,
0x07,0x73,0x07,0x71,0xDD,0x9C,0x03,0x10,0x39,0xC3,0x31,0xCC,0x73,0x1C,0xC6,0xC0,
0x03,0x72,0x00,0x71,0x9C,0x1C,0x03,0x18,0x39,0xC3,0x31,0xCC,0x77,0x1D,0xC6,0xC0,
0x03,0x76,0x00,0x71,0x9C,0x1C,0x03,0x08,0x39,0xC7,0x31,0xDC,0x67,0x1D,0xC7,0x80,
0x02,0x74,0x00,0x73,0x1C,0x1C,0x03,0x04,0x38,0xE7,0x71,0x9C,0xE7,0x39,0x83,0x80,
0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,
0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,
0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x06,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0xC0,0x00,0x0C,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0xC0,0x00,0x0C,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x18,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x00,0x30,0x00,0x05,0x04,0x84,0x00,0x00,0x00,0x01,0x04,0x00,0x14,0x00,
0x00,0x11,0x10,0x08,0x00,0x04,0x82,0x48,0x1F,0xF0,0x00,0x00,0x84,0x00,0x12,0x00,
0x00,0x1F,0xF0,0x04,0x00,0x04,0x0F,0xFE,0x00,0x10,0x00,0x00,0x04,0x00,0x10,0x00,
0x00,0x00,0x40,0x04,0x03,0xFF,0x88,0x02,0x08,0x10,0x00,0x03,0xE7,0x8F,0xFE,0x00,
0x00,0x12,0x40,0x0A,0x00,0x04,0x03,0xF8,0x04,0x10,0x00,0x00,0x04,0x00,0x10,0x00,
0x00,0x3F,0x78,0x0A,0x00,0x04,0x00,0x10,0x02,0x10,0x00,0x02,0x44,0x00,0x10,0x00,
0x00,0x12,0x88,0x0A,0x01,0xF4,0x00,0x20,0x00,0x50,0xFF,0xE1,0x5F,0x87,0xD0,0x00,
0x00,0x12,0x20,0x11,0x00,0x44,0x0F,0xFE,0x01,0x90,0x00,0x01,0x50,0x81,0x10,0x00,
0x00,0x1E,0x20,0x11,0x00,0x42,0x00,0x40,0x06,0x10,0x00,0x00,0x90,0x81,0x08,0x00,
0x00,0x12,0x50,0x20,0x80,0x42,0x80,0x40,0x38,0x10,0x00,0x00,0xD0,0x81,0x0A,0x00,
0x00,0x12,0x50,0x40,0x40,0x79,0x80,0x40,0x00,0x10,0x00,0x03,0x1F,0x81,0xE6,0x00,
0x00,0x1E,0x88,0x80,0x23,0x80,0x81,0xC0,0x00,0xE0,0x00,0x00,0x10,0x8E,0x02,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x11,0xF0,0x04,0x00,0x40,0x00,0x80,0x13,0xE0,0x51,0x00,0x20,0x00,0x00,
0x00,0x00,0x1C,0x90,0x04,0x00,0x20,0x1F,0xFC,0x12,0x20,0x51,0x07,0xFF,0x00,0x00,
0x00,0x00,0x24,0x91,0x3F,0x87,0xFF,0x11,0x04,0x13,0xE0,0x91,0x01,0x04,0x00,0x00,
0x00,0x00,0x49,0x30,0x84,0x80,0x80,0x0F,0xF8,0x7E,0x20,0xBF,0x80,0x88,0x00,0x00,
0x00,0x00,0x3E,0x00,0x04,0x80,0x80,0x02,0x20,0x13,0xE1,0x91,0x03,0xFE,0x00,0x00,
0x00,0x00,0x2A,0xA0,0x04,0x80,0xFE,0x01,0xC0,0x10,0x00,0x91,0x02,0x52,0x00,0x00,
0x00,0x00,0x3E,0xF0,0x7F,0xC0,0x82,0x1E,0x38,0x1B,0xF0,0x91,0x02,0x8A,0x00,0x00,
0x00,0x00,0x2B,0x20,0x04,0x00,0x82,0x00,0x80,0x70,0x80,0xFF,0xC3,0x76,0x00,0x00,
0x00,0x00,0x3E,0x20,0x8A,0x01,0x02,0x1F,0xFC,0x12,0xE0,0x80,0x02,0x52,0x00,0x00,
0x00,0x00,0x2A,0xF1,0x0A,0x01,0x02,0x02,0xA0,0x12,0x80,0x91,0x02,0x72,0x00,0x00,
0x00,0x00,0x2A,0x20,0x11,0x02,0x02,0x04,0x90,0x12,0x80,0xA0,0x82,0x02,0x00,0x00,
0x00,0x00,0x46,0x20,0x60,0xC4,0x1C,0x18,0x8C,0x35,0xF0,0xC0,0x42,0x06,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
///////////////////////////////////////////////////////////////////////
函數(shù)名稱:DelayUs
函數(shù)功能:讓單片機延時10us,即當iNumber=10時,延時為100us
參數(shù)介紹:iNumber:定義要延時10us的次數(shù)
返回值:
注意事項:無
///////////////////////////////////////////////////////////////////////
void DelayUs(uint iNumber)
{
}
///////////////////////////////////////////////////////////////////////
函數(shù)名稱:毫秒延時函數(shù)
函數(shù)功能:實現(xiàn)毫秒級的延時
參數(shù)介紹:Delay_MS: 定義需要延時的毫秒的數(shù)值
返回值:
注意事項:本實驗是在所用晶振為12M的前提下實現(xiàn)的毫秒延時,本函數(shù)是通過循環(huán)的形
///////////////////////////////////////////////////////////////////////
void DelayMs(uint Delay_MS)
{
}
///////////////////////////////////////////////////////////////////////
函數(shù)名稱:WriteLCD_CommdData
函數(shù)功能:向12864寫入一條命令或一個字節(jié)的數(shù)據(jù)
參數(shù)介紹:cCommd:選擇是寫入命令了還是數(shù)據(jù),當cCommd=1時,為命令,cCommd=0相反
返回值:
注意事項:無
///////////////////////////////////////////////////////////////////////
void WriteLCD_CommdData(uchar cCommd,uchar cData)
{
}
///////////////////////////////////////////////////////////////////////
函數(shù)名稱:Init_LCD()
函數(shù)功能:初始化12864液晶
參數(shù)介紹:無
返回值:
注意事項:初始化的具體過程請看12864的數(shù)據(jù)手冊
///////////////////////////////////////////////////////////////////////
void Init_LCD()
{
}
//液晶自定義顯示
void Lcd_define(uchar *str)
{
}
//主函數(shù)
void main()
{
}
評論