• 大小: 41KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-04
  • 语言: 其他
  • 标签: 单片机  12864LCD  

资源简介

单片机实现开关控制12864LCD串行模式显示并实现proteus仿真

资源截图

代码片段和文件信息

#include 
#include 
#define uint unsigned int
#define uchar unsigned char
#define Max_Page 6
#define DelayNOP() {_nop_();_nop_();_nop_();_nop_();}

sbit CS  = P2^3;
sbit RES = P2^4;
sbit SDA = P2^5;
sbit SCLK = P2^6;
sbit A0  = P2^7;
sbit K1  = P1^5;
sbit K2  = P1^6;
sbit S1  = P1^7;

uchar Auto_Flash;
uchar Page_Idx;
uchar Disp_Flag;

uchar code Q[8]=
{
  0x000x5e0x210x510x410x410x3e0x00
};

uchar code Clip_BMP[1024]=
{
0xff0x010x010x010x010x010x010x010x010x010x010x010x01
};

void DelayMS(uint ms)
{
  uchar i;
while(ms--)
{
  for(i=0;i<120;i++);
}
}

void Write_Command(uchar c)
{
  uchar i;
SCLK = 0;
CS = 0;
A0 = 0;
DelayNOP();
for(i=0;i<8;i++)
{
  c<<=1;
SDA = CY;
SCLK = 1;
DelayNOP();
SCLK = 0;
}
DelayNOP();
CS = 1;
}

void Write_Data(uchar d)
{
  uchar i;
SCLK = 0;
CS = 0;
A0 = 1;
DelayNOP();
for(i=0;i<8;i++)
{
  d<<=1;
SDA = CY;
SCLK = 1;
DelayNOP();
SCLK = 0;
}
DelayNOP();
CS = 1;
}

void Init_LCD()
{
  RES = 0;
DelayMS(10);
RES = 1;
Write_Command(0xa2);
Write_Command(0xa0);
Write_Command(0xc8);
Write_Command(0x27);
Write_Command(0x81);
Write_Command(0x1b);
Write_Command(0x2c);
Write_Command(0x2e);
Write_Command(0x2f);
Write_Command(0xa4);
Write_Command(0xaf);
}

void Disp_All()
{
  uchar ij;
Write_Command(0x40);
for(i=0;i<8;i++)
{
  Write_Command(0xb0+i);
Write_Command(0x10);
Write_Command(0x00);
for(j=0;j<128;j++)
{
  Write_Data(0xff);
}
}
}

void Disp_Off()
{
  uchar ij;
Write_Command(0x40);
for(i=0;i<8;i++)
{
  Write_Command(0xb0+i);
Write_Command(0x10);
Write_Command(0x00);
for(j=0;j<128;j++)
{
  Write_Data(0x00);
}
}
}

void Disp_frame()
{
  uchar ij;
Write_Command(0x40);
Write_Command(0xb0);
Write_Command(0x10);
Write_Command(0x00);
Write_Data(0xff);
for(j=0;j<126;j++)
{
  Write_Data(0x01);
}
Write_Data(0xff);
for(i=0;i<6;i++)
{
  Write_Command(0xb0+i);
Write_Command(0x10);
Write_Command(0x00);
Write_Data(0xff);
for(j=0;j<126;j++)
{
  Write_Data(0x00);
}
Write_Data(0xff);
}
Write_Command(0xb7);
Write_Command(0x10);
Write_Command(0x00);
Write_Data(0xff);
for(j=0;j<126;j++)
{
  Write_Data(0x80);
}
Write_Data(0xff);
}

void Disp_Checker0()
{
  uchar ij;
Write_Command(0x40);
for(i=0;i<8;i++)
{
  Write_Command(0xb0+i);
Write_Command(0x10);
Write_Command(0x00);
for(j=0;j<64;j++)
{
  Write_Data(0xaa);
Write_Data(0x55);
}
}
}

void Disp_Checker1()
{
  uchar ij;
Write_Command(0x40);
for(i=0;i<8;i++)
{
  Write_Command(0xb0+i);
Write_Command(0x10);
Write_Command(0x00);
for(j=0;j<64;j++)
{
  Write_Data(0x55);
Write_Data(0xaa);
}
}
}

void Disp_Q()
{
  uchar ijk;
Write_Command(0x40);
for(i=0;i<8;i++)
{
  Write_Command(0xb0+i);
Wr

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-05-07 15:49  17 开关控制12864LCD串行模式显示\
     目录           0  2013-05-07 15:49  17 开关控制12864LCD串行模式显示\Keil C\
     文件        4711  2009-03-11 11:29  17 开关控制12864LCD串行模式显示\Keil C\开关控制12864LCD串行模式显示
     文件        5025  2009-03-11 11:29  17 开关控制12864LCD串行模式显示\Keil C\开关控制12864LCD串行模式显示.hex
     文件       33133  2009-03-11 11:24  17 开关控制12864LCD串行模式显示\Last Loaded 开关控制12864LCD串行模式显示.DBK
     目录           0  2013-05-07 15:49  17 开关控制12864LCD串行模式显示\code\
     文件       13355  2009-08-12 16:03  17 开关控制12864LCD串行模式显示\code\17
     文件       11898  2009-08-12 16:03  17 开关控制12864LCD串行模式显示\code\17.LST
     文件       17013  2009-08-12 16:03  17 开关控制12864LCD串行模式显示\code\17.M51
     文件       15138  2009-08-12 16:03  17 开关控制12864LCD串行模式显示\code\17.OBJ
     文件         980  2009-08-12 16:06  17 开关控制12864LCD串行模式显示\code\17.Opt
     文件        2134  2009-08-12 16:06  17 开关控制12864LCD串行模式显示\code\17.Uv2
     文件        4279  2009-08-12 16:01  17 开关控制12864LCD串行模式显示\code\17.c
     文件        5021  2009-08-12 16:03  17 开关控制12864LCD串行模式显示\code\17.hex
     文件          36  2009-08-12 16:03  17 开关控制12864LCD串行模式显示\code\17.lnp
     文件         652  2009-08-12 16:06  17 开关控制12864LCD串行模式显示\code\17.plg
     文件       33133  2009-03-11 11:30  17 开关控制12864LCD串行模式显示\开关控制12864LCD串行模式显示.DSN
     文件         885  2009-08-12 16:03  17 开关控制12864LCD串行模式显示\开关控制12864LCD串行模式显示.PWI

评论

共有 条评论