单片机源代码:
//马与熊的显示
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit rs=P3^5;
sbit rw=P3^6;
sbit en=P3^4;
sbit cs1=P3^1;
sbit cs2=P3^0;
uchar pianxian,ye,lie,shu;
void delay(uint k);
uchar code xiong[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x00,0xC0,0x00,0x00,0x00,0x66,0x70,0x40,0x80,0xF0,0xF8,0xFC,0xFE,0xFE,
0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x7E,0x7E,0x7C,0x70,0xE0,0xE0,0xEF,0xE7,0xC3,0xC2,
0xB3,0x07,0x01,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,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0xC3,0xE3,0x72,0x3B,0x1C,0x0E,0x07,0x07,0x0B,0x01,0x03,0x03,0x03,0x8B,
0xC9,0xC8,0xC0,0xE0,0xE0,0xE0,0xC0,0xC0,0x00,0x06,0x00,0x0C,0xB0,0xD0,0xD0,0xD1,
0x83,0x1F,0xFF,0xFF,0xFF,0xFE,0xFE,0x7C,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x8C,0xE7,0xF0,0xFC,0xFE,0xFE,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFD,0xF0,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x0F,0x1F,0x9F,
0xDF,0x9F,0x1F,0x1F,0xCF,0xC7,0xC3,0xC1,0x80,0xE0,0xE8,0xC6,0x1F,0x7F,0xFF,0x7F,
0xBF,0xFF,0xFE,0xFF,0xCF,0xC3,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0xE4,0xFA,0x7C,0x1F,0x0F,0x0F,0x3F,0x7F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xDF,0xEF,0xE7,0xF3,0xFB,0xFF,0xFF,
0xFF,0xFF,0xFF,0xF6,0xFE,0xFF,0xDF,0xFF,0xFF,0xFF,0xFF,0xF9,0xF8,0xFC,0xFE,0xFE,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0xC0,0xC6,0xC0,0xC0,0xC0,
0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0x70,0x70,0x70,0x74,0x74,0x70,0xE0,0xF0,0xF0,
0xF8,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xF8,0xF0,0xE6,0x86,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xC2,0xFC,0xFF,0x7F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,
0x13,0x07,0x07,0x0F,0x1F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x1F,0x1F,0x2F,0x9F,0x7F,0x7F,0xFF,
0xFF,0xDF,0x0F,0x1F,0x3F,0x7B,0x71,0xE1,0x00,0xD0,0xE0,0xF0,0xF0,0x30,0x18,0x18,
0x0C,0x0E,0x0E,0x07,0x07,0x07,0x03,0x03,0x01,0x01,0x01,0xE0,0xF8,0xFE,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE3,0x80,0xC1,0xC0,0x00,0xC0,0x00,0x01,0x03,0x03,
0x03,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x05,0x01,0x03,0x07,0x0F,0x0E,0x3F,0x1C,
0x38,0xF8,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xA0,0x00,0x60,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x7F,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0,0xC8,
0xE8,0xEC,0xF4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xFF,0xEF,0xEF,0xFF,0xF7,0xFF,0xFC,0xFE,
0xE7,0x03,0x01,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x83,0x87,0x0E,0x0E,0xAD,0x9F,0xBF,
0x3F,0x9F,0xBF,0xBF,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x3F,0x1F,0x1F,
0x1F,0x1F,0x1F,0x0F,0x0F,0x2F,0x2F,0x0F,0x0F,0x0F,0x0F,0x0F,0x07,0x01,0x00,0x01,
0x01,0x01,0x01,0x00,0x00,0x00,0x07,0x0F,0x0E,0x0C,0x1F,0x1F,0x1F,0x1F,0x3F,0x3F,
0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x3B,0xC7,0xCF,0x1F,0x1F,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3E,0x3E,0x3D,0x00,0x00,0x00,0xC0,
0xC0,0xE0,0x00,0xC0,0xC1,0x07,0x8F,0x8F,0x9F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,
0x7F,0x7C,0x7C,0x78,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
uchar code ma[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x90,0xD0,0x78,0xF8,0xF8,0xF8,0xF0,0xF0,0xF0,0xE0,0xE0,
0xE0,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x06,0x0F,0x0F,0x07,0x0F,0x0F,0x0F,0xCF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xDD,0x9F,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0xF0,0x78,0xF8,0xF0,0xE0,0xC0,0xC0,0x80,
0xC0,0xE0,0xE0,0xF0,0xFC,0xFE,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFD,0x3B,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFC,0x9C,0x3C,0x3D,0x3F,0x7F,0xFD,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF9,0xE1,0xC3,0x87,
0x05,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFE,0xE3,0xF1,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x01,0x1F,0x1F,0x78,0xF0,0x00,0x00,0x00,0x01,
0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFE,0xFE,0xFC,0xF8,0xF0,0xE0,0x80,0x80,0x80,0xC0,0xE0,0xFF,0xDF,0x7F,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,0x07,0x1F,0x7F,0xFF,0xFF,0xEF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x1F,0x07,0xBF,0xFF,0x3F,0x1F,0x05,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,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,0x03,
0x07,0x07,0x07,0x07,0x06,0x06,0x06,0x06,0x0E,0x0E,0x0E,0x1F,0x1F,0x07,0x9F,0xFF,
0xFF,0x7B,0x61,0x00,0x00,0x00,0x00,0x00,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x18,0x18,0x1C,0x1E,0x07,0x03,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,
};
void command(uchar cmd);
void date(uchar dat);
void pianxuan(uchar pianxian);
void shuzu();
void LCD12864_init();
void main()
{
LCD12864_init();
while(1)
{
disp(&ma);
delay(500);
disp(&xiong);
delay(500);
}
}
void delay(uint k)
{
unsigned int i,j ;
for(i=0;i<k;i++)
{
for(j=0;j<800;j++)
; }
}
void command(uchar cmd)
{
rs=0;
rw=0;
P0=cmd;
en=1;
en=0;
}
void date(uchar dat)
{
rs=1;
rw=0;
P0=dat;
en=1;
en=0;
}
void pianxuan(uchar pianxian)
{
if(pianxian==1)
{
cs1=0;
cs2=1;
}
if(pianxian==2)
{
cs1=1;
cs2=0;
}
if(pianxian==3)
{
cs1=0;
cs2=0;
}
}
void shuzu()
{
pianxuan(pianxian);
command(ye);
command(lie);
date(shu);
}
void LCD12864_init()
{
command(0xc0);
command(0x3f);
}
全部资料51hei下载地址:
12864显示多图片.rar
(16.21 KB, 下载次数: 103)
|