#include "reg52.h" #include #include #define SSD_DATA P2 sbit SSD_CS=P3^3; sbit SSD_RES=P3^4; sbit SSD_DC=P3^5; sbit SSD_WR=P3^6; sbit SSD_RD=P3^7; ///////////////////////////////////////////////////////////////////////// // Bitmap // // ///////////////////////////////////////////////////////////////////////// unsigned char code nBitmapDot[] = // { Bitmap code }; //SSD1303 8080 parallel interface #include "main.h" #include "intrins.h" void Delay_us(unsigned char times) { unsigned char i,j; for(i=0;i for(j=0;j<24;j++) _nop_(); } } void Ssd_Command(unsigned char command){ SSD_DC=0; _nop_(); SSD_CS=0; _nop_(); SSD_RD=1; SSD_WR=0; _nop_(); SSD_DATA=command; Delay_us(1); SSD_WR=1; _nop_(); SSD_CS=1; } void Ssd_Data(unsigned char dat){ SSD_DC=1; _nop_(); SSD_CS=0; _nop_(); SSD_RD=1; SSD_WR=0; _nop_(); P2=dat; _nop_(); SSD_WR=1; _nop_(); SSD_CS=1; } void Ssd_Init(void){ SSD_RES=0; Delay_us(30); SSD_RES=1; Delay_us(20); Ssd_Command(0xae); //display off Ssd_Command(0x40); //display start line 00000 Ssd_Command(0x81); //contrast Ssd_Command(0x80); Ssd_Command(0x82); //brightness Ssd_Command(0x80); Ssd_Command(0xa0); //no remap Ssd_Command(0xa4); //intire display off Ssd_Command(0xa6); //normal display Ssd_Command(0xa8); //39 mux Ssd_Command(31); Ssd_Command(0xad); //DCDC off Ssd_Command(0x8a); Ssd_Command(0xc8); //scan from COM[N-1] to COM0从COM[N-1] Ssd_Command(0xd3); //row 0->com 62 Ssd_Command(32); Ssd_Command(0xd5); // Ssd_Command(0x03); // Ssd_Command(0xd8); //mono mode,normal power mode mono Ssd_Command(0x00); //? Ssd_Command(0xda); //alternative COM pin configuration Ssd_Command(0x12); Ssd_Command(0xaf); //display on } void main(void){ unsigned char i,j1; unsigned int k; Ssd_Init(); for(i=0;i<4;i++) { Ssd_Command(0xB0+i);// Ssd_Command(0x00); // Ssd_Command(0x10); // for(j1=0;j1<128;j1++) Ssd_Data(nBitmapDot[128*i+j1]); } while(1); }