单片机用LCD12864显示图片时图片输出问题 40
程序是这样的..如下。但是我弄的图片总是显示不好,一团糟。用软件将图片转换成数据时该怎么弄.?#include<reg52.h>#defineLCDP0unsignedc...
程序是这样的..如下。但是我弄的图片总是显示不好,一团糟。用软件将图片转换成数据时该怎么弄.?
#include<reg52.h>#define LCD P0unsigned char a,i,j,k;int b;sbit EN=P2^2;sbit RW=P2^1;sbit RS=P2^0;sbit CS1=P2^3;sbit CS2=P2^4;sbit BUSY=P0^0;
char code nBitmapDot[] = // 数据表{
}; checkbusy(){ EN=1; RW=1; RS=0; LCD=0XFF; if(BUSY);}
writecode(unsigned char dat) //写命令{ checkbusy(); EN=1; RW=0; RS=0; LCD=dat; EN=1; EN=0;}writedata(unsigned char dat) //写数据{ checkbusy(); EN=1; RW=0; RS=1; LCD=dat; EN=1; EN=0;}//满屏显示图片函数void LCDDisplay(unsigned char page,unsigned char lineaddress, unsigned char table[8][128]){ for(i=0;i<8;i++) { if(lineaddress<0X80) { CS1=0; CS2=0; } writecode(page+i); writecode(lineaddress); for(j=0;j<64;j++) { writedata(table[i][j]); lineaddress+=1; } if(lineaddress>=0X80) { CS1=0; CS2=1; lineaddress=lineaddress-0X40; } writecode(page+i); writecode(lineaddress); for(j=64;j<128;j++) { writedata(table[i][j]); lineaddress+=1; } if(lineaddress>=0X80) { lineaddress=lineaddress-0X40; } }}//半屏显示函数void LCDDisplay12(unsigned char page,unsigned char lineaddress,unsigned char table[8][64]){ if(lineaddress<0X80) { CS1=1; CS2=0; } if(lineaddress>=0X80) { CS1=0; CS2=1; lineaddress=lineaddress-0X40; } for(i=0;i<8;i++) { writecode(page+i); writecode(lineaddress); for(j=0;j<64;j++) { writedata(table[i][j]); } } }
void lcdinti(){ writecode(0X3F); writecode(0XC0); writecode(0XB8); writecode(0X40); //64} main(){ lcdinti(); LCDDisplay(0xb8,0x40,&nBitmapDot); while(1);} 展开
#include<reg52.h>#define LCD P0unsigned char a,i,j,k;int b;sbit EN=P2^2;sbit RW=P2^1;sbit RS=P2^0;sbit CS1=P2^3;sbit CS2=P2^4;sbit BUSY=P0^0;
char code nBitmapDot[] = // 数据表{
}; checkbusy(){ EN=1; RW=1; RS=0; LCD=0XFF; if(BUSY);}
writecode(unsigned char dat) //写命令{ checkbusy(); EN=1; RW=0; RS=0; LCD=dat; EN=1; EN=0;}writedata(unsigned char dat) //写数据{ checkbusy(); EN=1; RW=0; RS=1; LCD=dat; EN=1; EN=0;}//满屏显示图片函数void LCDDisplay(unsigned char page,unsigned char lineaddress, unsigned char table[8][128]){ for(i=0;i<8;i++) { if(lineaddress<0X80) { CS1=0; CS2=0; } writecode(page+i); writecode(lineaddress); for(j=0;j<64;j++) { writedata(table[i][j]); lineaddress+=1; } if(lineaddress>=0X80) { CS1=0; CS2=1; lineaddress=lineaddress-0X40; } writecode(page+i); writecode(lineaddress); for(j=64;j<128;j++) { writedata(table[i][j]); lineaddress+=1; } if(lineaddress>=0X80) { lineaddress=lineaddress-0X40; } }}//半屏显示函数void LCDDisplay12(unsigned char page,unsigned char lineaddress,unsigned char table[8][64]){ if(lineaddress<0X80) { CS1=1; CS2=0; } if(lineaddress>=0X80) { CS1=0; CS2=1; lineaddress=lineaddress-0X40; } for(i=0;i<8;i++) { writecode(page+i); writecode(lineaddress); for(j=0;j<64;j++) { writedata(table[i][j]); } } }
void lcdinti(){ writecode(0X3F); writecode(0XC0); writecode(0XB8); writecode(0X40); //64} main(){ lcdinti(); LCDDisplay(0xb8,0x40,&nBitmapDot); while(1);} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询