如何看懂下面的程序 ( 积分: 10 )

  • 主题发起人 主题发起人 uedit
  • 开始时间 开始时间
U

uedit

Unregistered / Unconfirmed
GUEST, unregistred user!
#include "reg52.h"
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int
#define LcdDataPort P1
sbit _WR=P3^7;
sbit RS=P3^6;
sbit _RES=P3^5;
sbit _CS1=P3^4;
uchar code Pic[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,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,0x84,0xC8,0x21,0x00,0x23,0x29,0xA5,
0xF9,0xA1,0x25,0x29,0x23,0x00,0x08,0x08,
0xFF,0x88,0x88,0xFF,0x00,0x00,0xFF,0x00,
0x00,0xFF,0x00,0x00,0x44,0x44,0xFF,0x24,
0x54,0x21,0xF9,0x27,0x21,0x21,0xE1,0x01,
0x00,0x10,0x16,0x1A,0xD2,0x5F,0x52,0x52,
0x5F,0x52,0xDA,0x16,0x12,0x00,0x22,0xF1,
0x08,0x17,0xD4,0x57,0xD4,0x17,0x78,0x87,
0x7C,0x04,0x00,0x00,0xFE,0x92,0x92,0x92,
0xFF,0x92,0x92,0x92,0xFE,0x00,0x00,0x00,
0x10,0x11,0x11,0x11,0x11,0x11,0xFD,0x15,
0x13,0x11,0x11,0x10,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,0x07,0x00,0x02,0x02,0x01,0x00,
0x07,0x00,0x01,0x02,0x02,0x00,0x01,0x03,
0x01,0x04,0x02,0x01,0x00,0x00,0x01,0x00,
0x00,0x07,0x00,0x00,0x00,0x04,0x07,0x00,
0x00,0x00,0x07,0x02,0x02,0x02,0x07,0x00,
0x00,0x00,0x00,0x00,0x07,0x05,0x05,0x05,
0x05,0x05,0x07,0x00,0x00,0x00,0x00,0x07,
0x04,0x02,0x01,0x00,0x03,0x05,0x02,0x01,
0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x04,0x04,0x04,0x04,0x04,0x07,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x07,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,0x01,0x01,0x01,0xFF,0x01,0x01,
0x01,0x00,0x00,0xFC,0x02,0x01,0x01,0x01,
0x01,0x02,0xFC,0x00,0x00,0xFF,0x21,0x21,
0x21,0x21,0x21,0x1E,0x00,0x03,0x1C,0xE0,
0x00,0xE0,0x1E,0x01,0x1E,0xE0,0x00,0xE0,
0x1C,0x03,0x00,0xC0,0x70,0x4E,0x41,0x4E,
0x70,0xC0,0x00,0x00,0x01,0x06,0x18,0xE0,
0x18,0x06,0x01,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,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x02,
0x02,0x01,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x00,0x00,0x03,0x00,
0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x03,
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,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0xC0,
0xE0,0x00,0xC0,0x20,0x20,0x20,0x20,0x40,
0x00,0xC0,0x20,0x20,0x20,0x20,0xC0,0x00,
0x40,0x20,0x20,0x20,0x20,0xC0,0x00,0xC0,
0x20,0x20,0x20,0x20,0xC0,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,
0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x00,
0x7F,0x00,0x03,0x1C,0x60,0x1C,0x03,0x00,
0x7F,0x00,0x3F,0x44,0x42,0x42,0x42,0x3C,
0x00,0x3F,0x40,0x40,0x40,0x40,0x3F,0x00,
0x40,0x60,0x50,0x48,0x44,0x43,0x00,0x23,
0x44,0x44,0x44,0x22,0x1F,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,
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,0x00,0x00,0x00,0x00,0x00
};
//--------------------------------------
//延时子函数
//--------------------------------------
液晶显示模块应用手册LM6029
void Delay(uint Delx)
{
uint i=0;
while(i<Delx)
i++;
}
//--------------------------------------
//写指令函数
//--------------------------------------
void LcdCommand(uchar Com)
{
RS=0;
LcdDataPort=Com;
_nop_();_nop_();_nop_();
_WR=0;
_nop_();_nop_();_nop_();
_WR=1;
}
//--------------------------------------
//写数据函数
//--------------------------------------
void LcdDataWrite(uchar Data)
{
RS=1;
LcdDataPort=Data;
_nop_();_nop_();_nop_();
_WR=0;
_nop_();_nop_();_nop_();
_WR=1;
}
//--------------------------------------
//初始化函数
//--------------------------------------
void Initialize()
{
_CS1=0;
_RES=0;
Delay(1000);
_RES=1;
LcdCommand(0xa0);
LcdCommand(0xc8);
LcdCommand(0xa2);
LcdCommand(0x2f);
LcdCommand(0x81);
LcdCommand(0x29);
LcdCommand(0x40);
LcdCommand(0xaf);
}
//--------------------------------------
//设置显示位置
//--------------------------------------
void SetPage(uchar Page)
{
Page=Page &amp;
0x0f;
Page=Page | 0xb0;
LcdCommand(Page);
}
void SetColumn(uchar Column)
{
uchar temp;
temp=Column;
Column=Column &amp;
0x0f;
Column=Column | 0x00;
LcdCommand(Column);
temp=temp>>4;
Column=temp &amp;
0x0f;
Column=Column | 0x10;
LcdCommand(Column);
}
//--------------------------------------
//清屏
//--------------------------------------
void ClearScr()
{
uchar i,j;
for(i=0;i<8;i++)
{
SetColumn(0);
SetPage(i);
for(j=0;j<128;j++)
LcdDataWrite(0x00);
}
}
//--------------------------------------
//显示子函数
//--------------------------------------
void DisplayPic(uchar Page,uchar
Column,uchar *PicKu)
{
uchar i,j;
for(j=0;j<8;j++)
{
SetPage(Page+j);
SetColumn(Column);
for(i=0;i<128;i++)
LcdDataWrite(PicKu[i+j*128]);
}
}
//--------------------------------------
//主函数
//--------------------------------------
void Main()
{
Initialize();
Delay(1000);
ClearScr();
DisplayPic(0,0,Pic);
while(1)
{};
}
 
#include "reg52.h"
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int
#define LcdDataPort P1
sbit _WR=P3^7;
sbit RS=P3^6;
sbit _RES=P3^5;
sbit _CS1=P3^4;
uchar code Pic[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,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,0x84,0xC8,0x21,0x00,0x23,0x29,0xA5,
0xF9,0xA1,0x25,0x29,0x23,0x00,0x08,0x08,
0xFF,0x88,0x88,0xFF,0x00,0x00,0xFF,0x00,
0x00,0xFF,0x00,0x00,0x44,0x44,0xFF,0x24,
0x54,0x21,0xF9,0x27,0x21,0x21,0xE1,0x01,
0x00,0x10,0x16,0x1A,0xD2,0x5F,0x52,0x52,
0x5F,0x52,0xDA,0x16,0x12,0x00,0x22,0xF1,
0x08,0x17,0xD4,0x57,0xD4,0x17,0x78,0x87,
0x7C,0x04,0x00,0x00,0xFE,0x92,0x92,0x92,
0xFF,0x92,0x92,0x92,0xFE,0x00,0x00,0x00,
0x10,0x11,0x11,0x11,0x11,0x11,0xFD,0x15,
0x13,0x11,0x11,0x10,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,0x07,0x00,0x02,0x02,0x01,0x00,
0x07,0x00,0x01,0x02,0x02,0x00,0x01,0x03,
0x01,0x04,0x02,0x01,0x00,0x00,0x01,0x00,
0x00,0x07,0x00,0x00,0x00,0x04,0x07,0x00,
0x00,0x00,0x07,0x02,0x02,0x02,0x07,0x00,
0x00,0x00,0x00,0x00,0x07,0x05,0x05,0x05,
0x05,0x05,0x07,0x00,0x00,0x00,0x00,0x07,
0x04,0x02,0x01,0x00,0x03,0x05,0x02,0x01,
0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x04,0x04,0x04,0x04,0x04,0x07,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x07,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,0x01,0x01,0x01,0xFF,0x01,0x01,
0x01,0x00,0x00,0xFC,0x02,0x01,0x01,0x01,
0x01,0x02,0xFC,0x00,0x00,0xFF,0x21,0x21,
0x21,0x21,0x21,0x1E,0x00,0x03,0x1C,0xE0,
0x00,0xE0,0x1E,0x01,0x1E,0xE0,0x00,0xE0,
0x1C,0x03,0x00,0xC0,0x70,0x4E,0x41,0x4E,
0x70,0xC0,0x00,0x00,0x01,0x06,0x18,0xE0,
0x18,0x06,0x01,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,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x02,
0x02,0x01,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x00,0x00,0x00,0x00,0x00,0x03,0x00,
0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x03,
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,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0xC0,
0xE0,0x00,0xC0,0x20,0x20,0x20,0x20,0x40,
0x00,0xC0,0x20,0x20,0x20,0x20,0xC0,0x00,
0x40,0x20,0x20,0x20,0x20,0xC0,0x00,0xC0,
0x20,0x20,0x20,0x20,0xC0,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,
0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x00,
0x7F,0x00,0x03,0x1C,0x60,0x1C,0x03,0x00,
0x7F,0x00,0x3F,0x44,0x42,0x42,0x42,0x3C,
0x00,0x3F,0x40,0x40,0x40,0x40,0x3F,0x00,
0x40,0x60,0x50,0x48,0x44,0x43,0x00,0x23,
0x44,0x44,0x44,0x22,0x1F,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,
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,0x00,0x00,0x00,0x00,0x00
};
//--------------------------------------
//延时子函数
//--------------------------------------
液晶显示模块应用手册LM6029
void Delay(uint Delx)
{
uint i=0;
while(i<Delx)
i++;
}
//--------------------------------------
//写指令函数
//--------------------------------------
void LcdCommand(uchar Com)
{
RS=0;
LcdDataPort=Com;
_nop_();_nop_();_nop_();
_WR=0;
_nop_();_nop_();_nop_();
_WR=1;
}
//--------------------------------------
//写数据函数
//--------------------------------------
void LcdDataWrite(uchar Data)
{
RS=1;
LcdDataPort=Data;
_nop_();_nop_();_nop_();
_WR=0;
_nop_();_nop_();_nop_();
_WR=1;
}
//--------------------------------------
//初始化函数
//--------------------------------------
void Initialize()
{
_CS1=0;
_RES=0;
Delay(1000);
_RES=1;
LcdCommand(0xa0);
LcdCommand(0xc8);
LcdCommand(0xa2);
LcdCommand(0x2f);
LcdCommand(0x81);
LcdCommand(0x29);
LcdCommand(0x40);
LcdCommand(0xaf);
}
//--------------------------------------
//设置显示位置
//--------------------------------------
void SetPage(uchar Page)
{
Page=Page &amp;
0x0f;
Page=Page | 0xb0;
LcdCommand(Page);
}
void SetColumn(uchar Column)
{
uchar temp;
temp=Column;
Column=Column &amp;
0x0f;
Column=Column | 0x00;
LcdCommand(Column);
temp=temp>>4;
Column=temp &amp;
0x0f;
Column=Column | 0x10;
LcdCommand(Column);
}
//--------------------------------------
//清屏
//--------------------------------------
void ClearScr()
{
uchar i,j;
for(i=0;i<8;i++)
{
SetColumn(0);
SetPage(i);
for(j=0;j<128;j++)
LcdDataWrite(0x00);
}
}
//--------------------------------------
//显示子函数
//--------------------------------------
void DisplayPic(uchar Page,uchar
Column,uchar *PicKu)
{
uchar i,j;
for(j=0;j<8;j++)
{
SetPage(Page+j);
SetColumn(Column);
for(i=0;i<128;i++)
LcdDataWrite(PicKu[i+j*128]);
}
}
//--------------------------------------
//主函数
//--------------------------------------
void Main()
{
Initialize();
Delay(1000);
ClearScr();
DisplayPic(0,0,Pic);
while(1)
{};
}
 
没有环境,没试,但是看懂的办法最好就是一步步跟踪
必要时还得去看看汇编
 
写的很好!
从主函数看起,就是初始化、延时、清屏、显示图象、无限循环。
然后再看子函数,当然子函数有调用函数,一层层看下去就行了。
 
后退
顶部