我用的是44b0,就是当单片机使了,程序调了好长时间,就是不显示,大家帮我看看,谢谢啦,还有,液晶显示的静态和动态有什么差别?
这个程序里,我没有让它显示汉字,我想先让它全屏都亮(先试试好不好使),然后再显示汉字,所以,hp()程序我给修改了。
#define setA0 rPDATE |= 0x0008;//A0=1 #define clrA0 rPDATE &= 0xfff7;//A0=0
#define setE1 rPDATE |= 0x0040;//E1=1 #define clrE1 rPDATE &= 0xffbf;//E1=0
#define setE2 rPDATE |= 0x0020;//E2=1 #define clrE2 rPDATE &= 0xffdf;//E2=0
#define setReset rPDATE |= 0x0080;//Reset=1 #define clrReset rPDATE &= 0xff7f;//Reset=0
#define setR rPDATE |= 0x0010;//R/W=1 #define clrR rPDATE &= 0xffef;//R/W=0
#define Data rPDATC ;
#define fuwei (0xe2); #define kxshq 0xaf; #define gxshq 0xae; #define dtqd 0xa4; #define jtqd 0xa5; #define zkb1 0xa9; #define zkb2 0xa8; #define szx1 0xa0; #define szx2 0xa1; #define xmsstop 0xee;
extern unsigned char bmp1[]; extern unsigned char bmp2[]; extern unsigned char bmp3[];
unsigned char bmp1[]= { /*-- 文字: 中 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ /*-- 文字: 中 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0x3F,0x10,0x00,0x00, 0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0xFF,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,0x00
};
unsigned char bmp2[]= {
/*-- 文字: 国 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x7F,0x40,0x50,0x51,0x51,0x51,0x5F,0x51,0x51,0x51,0x50,0x40,0x7F,0x00,0x00, 0x00,0xFF,0x02,0x12,0x12,0x12,0x12,0xF2,0x12,0x92,0x72,0x12,0x02,0xFF,0x00,0x00
};
unsigned char bmp3[]= { /*-- 文字: 人 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x02,0x04,0x08,0x30,0xC0,0x00,0x00,0x80,0x60,0x30,0x18,0x0C,0x06,0x04,0x00
};
/**********************************************************************************/ void Dalay(int i) { int m; for (;i>0;i--) { for (m=10000;m>0;m--); }
} /**********************************************************************************/ void lcd12232_WriteCommondMaster(unsigned char i) //写主芯片命令 { setE1; // dalay(10); clrA0; // Dalay(10); rPDATC=i; // Dalay(10); clrE1; //Dalay(10);
} /*************************************************************************************/
void lcd12232_WriteCommondSlave(unsigned char i) //写从芯片指令 { setE2; // Dalay(10); clrA0; // Dalay(10); rPDATC=i; // Dalay(10); clrE2; // Dalay(10);
}
/****************************************************************************/
void lcd12232_WriteDataMaster(unsigned char i) //发数据到主芯片 {
setE1; //Dalay(10); setA0; //Dalay(10); rPDATC=i; //Dalay(10); clrE1; //Dalay(10);
}
/************************************************************************************/
void lcd12232_WriteDataSlave(unsigned char i) //发数据到从芯片 {
setE2; //Dalay(10); setA0; // Dalay(10); rPDATC=i; // Dalay(10); clrE2; // Dalay(10);
}
/***************************************************************************************/
void lcd12232_IoInit() /*初始化IO,用C口 rPC0~7 == D0-D7 rPC8 == Reset rPC9 == E1 rPC10 == E2 rPC11 == R/W rPC12 == A0 rPC13 == LED+ rPC14 == LED- */ { rPCONA =0x100; rPCONC = 0x5f555555;//设置为输出口 clrE1; clrE2; clrR; clrReset; Dalay(100); setReset; }
void lcd12232_Init() //初始化lcd12232 { lcd12232_IoInit();//初始化IO clrR; lcd12232_WriteCommondMaster(0xe2); lcd12232_WriteCommondSlave(0xe2); //复位 lcd12232_WriteCommondMaster(0xae); lcd12232_WriteCommondSlave(0xae); //关显示器; lcd12232_WriteCommondMaster(0xa4); lcd12232_WriteCommondSlave(0xa4); //动态驱动 lcd12232_WriteCommondMaster(0xa9); lcd12232_WriteCommondSlave(0xa9); //1/32占空比 lcd12232_WriteCommondMaster(0xa0); lcd12232_WriteCommondSlave(0xa0); //顺时针 lcd12232_WriteCommondMaster(0xee); lcd12232_WriteCommondSlave(0xee); //停止改写模式 lcd12232_WriteCommondMaster(0x00); lcd12232_WriteCommondMaster(0xc0); lcd12232_WriteCommondSlave(0x00); lcd12232_WriteCommondSlave(0xc0); lcd12232_WriteCommondMaster(0xaf); lcd12232_WriteCommondSlave(0xaf); //开显示器;
}
/*************************************************************************************/
void lcd12232_SetPage(unsigned char page0,unsigned char page1) { lcd12232_WriteCommondMaster(0xB8|page1); lcd12232_WriteCommondSlave(0xB8|page0); }
/************************************************************************************/
void lcd12232_SetAddress(unsigned char address0,unsigned char address1) { lcd12232_WriteCommondMaster(address1&0x7F); lcd12232_WriteCommondSlave(address0&0x7F); } /*************************************************************************************/
/*void lcd12232_Playbmp(uchar x0,bit layer,uchar width,uchar *bmp)
{ char x,address,i=0; //address表示显存的物理地址 uchar page=0; bit window=0; //page表示上下两页,window表示左右两页 if (layer) page=2; for (x=x0;x<x0+width;x++) { if (x>60) {window=1;address=x%61;} else address=x; SetPage(page,page); SetAddress(address,address); if (window) PutChar1(bmp); else PutChar0(bmp);//画上层 SetPage(page+1,page+1); SetAddress(address,address); if (window) PutChar1(bmp[i+width]); else PutChar0(bmp[i+width]);//画下层 i++;
} } */
void clrscr(void) { unsigned char i; unsigned char page; for (page=0;page<4;page++) { lcd12232_SetPage(page,page); lcd12232_SetAddress(0,0); for (i=0;i<61;i++) { lcd12232_SetAddress(i,i); lcd12232_WriteDataMaster(0x00); lcd12232_WriteDataSlave(0x00); } } }
/* void hp(void) { int x,y; y=0; lcd12232_SetPage(0,y); for (x=0;x<16;x++) { lcd12232_SetAddress(0,x); lcd12232_WriteDataMaster(bmp1[x]); } y=1; lcd12232_SetPage(0,y); for (x=0;x<16;x++) { lcd12232_SetAddress(0,x); lcd12232_WriteDataMaster(bmp1[x+16]); }
} */ void hp(void) { unsigned char i; unsigned char page; for (page=0;page<4;page++) { lcd12232_SetPage(page,page); lcd12232_SetAddress(0,0); for (i=0;i<61;i++) { lcd12232_WriteDataMaster(0xff); lcd12232_WriteDataSlave(0xff); } } }
/**************************************************************************** 【功能说明】系统主函数 ****************************************************************************/ void Main(void) { //U16 m; rSYSCFG=0x0e; //使用8K字节的指令缓存
Port_Init(); //IO端口功能、方向设定 Isr_Init(); //中断初始化
//Lcd_Init(); //DMF50081(320×240)液晶模块初始化
//Led_Disp(); //LED来回闪烁显示 //Beep(500); //蜂鸣器鸣叫若干个100us
//ChangePllValue(8,2,1); //修改系统主频为2倍频
//Beep(1000); //蜂鸣器鸣叫若干个100us
//Lcd_Fill(0x33); //液晶显示屏全屏填充某一个8位二进制数
//for(m = 2; m > 0; m--) //{ // Led_Disp(); //LED来回闪烁显示 //} // //Timer_Pwm(); //定时器初始化,让PE7、6、5、4、3输出PWM信号
// while(1) //{ //Key_Speaker(); //检测四个按键,有任何一个按键按下就让蜂鸣器鸣叫,否则不鸣叫 // Led_Disp(); //LED来回闪烁显示 lcd12232_Init(); clrscr(); hp();
//} } //***************************************************************************
|