|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
程序编译没有问题,能运行,就是不显示!
请大家查看一下,望指点,谢谢!!
用PD(用其中一位)口做DATA,PF(用其中一位)口做WR,用PG(用其中一位)口做/CS.
#include <string.h>
#include <stdio.h>
#include "Target\44b.h"
#include "Target\44blib.h"
typedef unsigned char uchar;
void lcdint(void) //初始化HT1621.
{
rPDATG=0x0;
rPDATF=0x00;
Delay(1);
rPDATF=0xff;
Delay(1);
}
void write_byte(uchar k,uchar n)
{
uchar i,j;
for(i=0;i<n;i++)
{
if(k>=0x80) /
rPDATD = 0xff;
else
rPDATD = 0x0;
rPDATF = 0x0; //
Delay(1);
rPDATF = 0xff; //
Delay(1);
k=k<<1;
}
}
void write_com(uchar com)
{
lcdint();
write_byte(0x80,4); //写1000
write_byte(com,8);
rPDATF = 0xff; //
rPDATG = 0xff; //
Delay(1);
rPDATD = 0xff;//
}
void int1621(void)
{
write_com(0x52); //BIAS1/3
write_com(0x30); //RC256K
write_com(0x02); //SYS EN,打开系统振荡器
write_com(0x06); //打开LCD偏压发生器
}
void send1621data()
{
uchar a=1,b=0x80,c=0x11,d=10,e=0x0;
uchar j,k;
lcdint();
write_byte(b,a);
Delay(1);
write_byte(e,a);
Delay(1);
write_byte(b,a);
Delay(1);
write_byte(c,d); //從display buffer RAM 0x0000 開始
}
void Main(void)
{ unsigned int PCONGback=0,PCONFback=0,PCONDback=0;
unsigned int PUPGback=0,PUPFback=0,PUPDback;
char temp;
char Keyboard[4]={'1','2','3','4'};
char aa;
int i,j,x,a[11]={0xfc,0x0c,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6,0x02};
int y0,y1,y2,y3,y4,y5,y6,y7,y8,y9;
Port_Init();
Led_Display(0xf);
Beep(0x1);
Led_Display(0x0);
{
PCONGback=0;
PUPGback=0;
PCONFback=0;
PUPFback=0;
PCONDback=0;
PUPDback=0;
PCONGback=rPCONG;
PCONFback=rPCONF;
PCONDback=rPCOND;
PUPGback=rPUPG;
PUPFback=rPUPF;
PUPDback=rPUPD;
rPCONF = 0x5555;
rPCONG = 0x5555;//pf0-pf3utput, pf4-pf7:input
rPCOND = 0x5555;
rPUPG=0xff;//disable pull-up
rPUPF=0xff;
rPUPD=0xff;
rPDATG=0x00;//pf0-pf3:0
rPDATF=0x00;//pf0-pf3:0
rPDATD=0x00;
//////////////////////////////////
while(1)
{
int1621();
send1621data();
}
//////////////////////////////////////
rPCONG=PCONGback;
rPUPG=PUPGback;
rPCONF=PCONFback;
rPUPF=PUPFback;
rPCOND=PCONDback;
rPUPD=PUPDback;
Delay(10);
}
}
接口直接连接的,没有驱动.
有些代码是无效的.
有些代码是无效的.如:
char Keyboard[4]={'1','2','3','4'};
char aa;
int i,j,x,a[11]={0xfc,0x0c,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6,0x02};
int y0,y1,y2,y3,y4,y5,y6,y7,y8,y9; |
|