有谁用过LCD控制芯片S6B0724没,写个驱动,液晶一点反应都没有,调了好几天了,不知道错在哪里。高手们帮帮忙看看,单片机用的是PIC16F873,4M晶振,用的是8080的时序。
void LCD_WriteCmd(int8 cmd) { output_low(PIN_B2); //A0=0 output_high(PIN_B4); //R=1 //*(0x07)=cmd; output_c(cmd); #asm NOP NOP NOP #endasm output_low(PIN_B3); //WR=0 output_high(PIN_B3); //WR=1 }
void LCD_WriteDat(int8 dat) { output_high(PIN_B2); //A0=1 output_high(PIN_B4); //R=1 //*(0x07)=dat; output_c(dat); #asm NOP NOP NOP #endasm output_low(PIN_B3); //WR=0 output_high(PIN_B3); //WR=1 } int8 LCD_ReadStatus() { int8 dat; set_tris_c(0xff); output_low(PIN_B2); //A0=0 output_high(PIN_B3); //WR=1 output_low(PIN_B4); //R=0 #asm NOP NOP NOP #endasm dat=input_c(); output_high(PIN_B4); //R=1 set_tris_c(0x00); return dat; }
void LCD_Init() { output_low(PIN_B6); //8080 output_low(PIN_B5); //CS1=0; //液晶复位 output_low(PIN_B1); delay_ms(10); output_high(PIN_B1); delay_us(1); //ADC select seg0-seg131 LCD_WriteCmd(0xa0); //SHL select com0-com64 LCD_WriteCmd(0xc8); //LCD Bias select LCD_WriteCmd(0xa2); //Voltage Converter ON //Voltage Regulator ON //Voltage Follower ON LCD_WriteCmd(0x2c); delay_ms(2); LCD_WriteCmd(0x2a); delay_ms(2); LCD_WriteCmd(0x29); delay_ms(2); LCD_WriteCmd(0x81); LCD_WriteCmd(0x27); LCD_WriteCmd(0x40); LCD_WriteCmd(0xaf); }
void main() { int8 i=0; set_tris_a(0xff); set_tris_b(0x01); set_tris_c(0x00); port_b_pullups(0xff); LCD_Init();
i=LCD_ReadStatus(); putc(i); //串口输出状态
LCD_WriteCmd(0xb0); //setpage LCD_WriteCmd(0x00); LCD_WriteCmd(0x10); for(i=0;i<=50;i++) { LCD_WriteDat(0xff); } for(i=51;i<=100;i++) { LCD_WriteDat(0x00); }
LCD_WriteCmd(0xb1); //setpage LCD_WriteCmd(0x10); LCD_WriteCmd(0x0a); for(i=0;i<=50;i++) { LCD_WriteDat(0xff); } for(i=51;i<=100;i++) { LCD_WriteDat(0x00); } while(1);
} |