这是我收到的51 DEMO程序
#include <reg52.h>
sbit LcdRST = P2^0;
sbit LcdCS = P2^1;
sbit sdata = P2^2;
sbit sclk = P2^3;
sbit c_d = P2^4;
unsigned char code bmp130130[17424];
void Delay_nms(unsigned int MS)
{
unsigned char us,usn;
while(MS!=0) //for 12M
{
usn = 2;
while(usn!=0)
{
us = 0xf5;
while (us!=0)
{
us--;
};
usn--;
}
MS--;
}
}
void write_data(unsigned char dat)
{
unsigned char i;
c_d =1;
LcdCS=0;
for(i=0;i<8;i++)
{
sclk = 0;
dat=dat<<1;
sdata = CY;
sclk = 1;
sclk = 0;
}
LcdCS=1;
}
void write_data16(unsigned char datH,unsigned char datL)
{
unsigned char i;
c_d =1;
LcdCS=0;
for(i=0;i<8;i++)
{
sclk = 0;
datH=datH<<1;
sdata = CY;
sclk = 1;
sclk = 0;
}
for(i=0;i<8;i++)
{
sclk = 0;
datL=datL<<1;
sdata = CY;
sclk = 1;
sclk = 0;
}
LcdCS=1;
}
void write_cmd(unsigned char dat)
{
unsigned char i;
c_d =0;
LcdCS=0;
for(i=0;i<8;i++)
{
sclk = 0;
dat=dat<<1;
sdata = CY;
sclk = 1;
sclk = 0;
}
LcdCS=1;
}
//
void main(void)
{
unsigned int i;
LcdCS=1;
sclk=0;
LcdRST=1;
Delay_nms(100);
LcdRST=0;
Delay_nms(5);
LcdRST=1;
Delay_nms(100);
write_cmd(0x10);
write_data16(0x2f,0x8e);
write_cmd(0x11);
write_data16(0x00,0x0c);
write_cmd(0x07);
write_data16(0x00,0x21);
write_cmd(0x28);
write_data16(0x00,0x06);
write_cmd(0x28);
write_data16(0x00,0x05);
write_cmd(0x27);
write_data16(0x05,0x7f);
write_cmd(0x29);
write_data16(0x89,0xa1);
write_cmd(0x00); //write index, 16bits, high 8 bits is 0x00
write_data16(0x00,0x01); //write instruction, 16bits
Delay_nms(100);
write_cmd(0x29);
write_data16(0x80,0xb0);
Delay_nms(30);
write_cmd(0x29);
write_data16(0xff,0xfe);
write_cmd(0x07);
write_data16(0x00,0x23);
Delay_nms(30);
write_cmd(0x07);
write_data16(0x00,0x33);
write_cmd(0x01);
write_data16(0x21,0x83);
write_cmd(0x2f);
write_data16(0xff,0xff);
write_cmd(0x2c);
write_data16(0x80,0x00);
write_cmd(0x03);
write_data16(0x68,0x30);
write_cmd(0x27);
write_data16(0x05,0x70);
write_cmd(0x02);
write_data16(0x03,0x00);
write_cmd(0x0b);
write_data16(0x58,0x0c);
write_cmd(0x12);
write_data16(0x06,0x09);
write_cmd(0x13);
write_data16(0x31,0x00);
write_cmd(0x2a);
write_data16(0x1d,0xd0);
write_cmd(0x2b);
write_data16(0x0a,0x90);
write_cmd(0x2d);
write_data16(0x31,0x0f);
Delay_nms(100);
write_cmd(0x45);
write_data16(0x83,0x00);
write_cmd(0x44);
write_data16(0x83,0x00);
write_cmd(0x21);
write_data16(0x00,0x00);
write_cmd(0x1e);
write_data16(0x00,0xbf);
Delay_nms(1);
write_cmd(0x1e);
write_data16(0x00,0x00);
Delay_nms(100);
write_cmd(0x45);
write_data16(0x83,0x00);
write_cmd(0x44);
write_data16(0x83,0x00);
write_cmd(0x21);
write_data16(0x00,0x00);
write_cmd(0x22); //write data to GRAM
for (i=0;i<17424;i++)
{write_data(0xf8);
write_data(0x00);}
for (i=0;i<17424;i++)
write_data(bmp130130);
}
/*
unsigned char code bmp130130[]=
{
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00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