7726|8

63

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

【求助】求240128(T6963C)的液晶c语言显示程序 [复制链接]

请问哪位大侠有 240128(T6963C)的 c语言汉字显示程序 最近一直在找这个 没找到 , 可以参考下吗?.com

最新回复

请问D0~D7引脚如何接的  详情 回复 发表于 2012-7-28 16:12
 
点赞 关注

回复
举报

84

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
试一试:
#include <msp430x13x.h>
#define lcdwr BIT2 //p4.2
#define lcdrd BIT3 //p4.3
#define lcdce BIT4 //p4.4
#define lcdcd BIT5 //p4.5
#define lcdrst BIT6 //p4.6
#define lcdfs BIT7 //p4.7


unsigned char dian[32]={ 0x02,0x00,0x02,0x00,0x02,0x08,0x03,0xFC,
0x02,0x00,0x02,0x10,0x3F,0xF8,0x20,0x10,
0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,
0x29,0x10,0x24,0xC8,0x44,0x44,0x80,0x04};
unsigned char zhen[32]={ 0x00,0x80,0x78,0x84,0x4F,0xFE,0x50,0x80,
0x50,0xA0,0x61,0x20,0x51,0x28,0x4B,0xFC,
0x48,0x20,0x48,0x20,0x68,0x24,0x57,0xFE,
0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20};
unsigned char ye[32]={ 0x00,0x80,0x40,0x44,0x37,0xFE,0x10,0x20,
0x81,0x20,0x61,0x3C,0x22,0x44,0x0A,0x64,
0x16,0x98,0x2B,0x48,0xE2,0x50,0x22,0x20,
0x22,0x50,0x22,0x8E,0x23,0x04,0x22,0x00};
unsigned char jing[32]={ 0x0F,0xE0,0x08,0x20,0x08,0x20,0x0F,0xE0,
0x08,0x20,0x08,0x20,0x0F,0xE0,0x08,0x24,
0x7E,0xFE,0x42,0x84,0x42,0x84,0x7E,0xFC,
0x42,0x84,0x42,0x84,0x7E,0xFC,0x42,0x84};
unsigned char lian[32]={ 0x01,0x04,0xFE,0xCC,0x24,0x50,0x24,0x00,
0x3D,0xFC,0x24,0x20,0x24,0x20,0x24,0x24,
0x3F,0xFE,0x24,0x20,0x24,0x20,0x24,0x50,
0x3E,0x50,0xE4,0x88,0x05,0x0E,0x06,0x04};
unsigned char xi[32]={ 0x00,0x38,0x7F,0xC0,0x04,0x00,0x04,0x10,
0x08,0x20,0x3F,0xC0,0x01,0x00,0x02,0x20,
0x04,0x10,0x3F,0xF8,0x01,0x08,0x09,0x20,
0x09,0x10,0x11,0x08,0x25,0x08,0x02,0x00 };
unsigned char ren[32]={ 0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x02,0x80,
0x02,0x80,0x02,0x80,0x04,0x40,0x04,0x40,
0x08,0x20,0x10,0x10,0x20,0x0E,0x40,0x04};
unsigned char yang[32]={0x10,0x00,0x13,0xF8,0x10,0x10,0x10,0x20,
0xFC,0x40,0x10,0x84,0x33,0xFE,0x38,0xA4,
0x54,0xA4,0x50,0xA4,0x91,0x24,0x11,0x44,
0x12,0x44,0x14,0x84,0x11,0x28,0x10,0x10};
unsigned char xiao[32]={0x00,0x80,0x08,0x88,0x7C,0xFC,0x4F,0x80,
0x48,0x50,0x48,0x22,0x78,0xD2,0x4B,0x0E,
0x48,0x00,0x4B,0xFC,0x48,0xA0,0x78,0xA0,
0x49,0x22,0x01,0x22,0x02,0x1E,0x0C,0x00};
unsigned char llong[32]={0x02,0x00,0x02,0x40,0x02,0x20,0x02,0x04,
0xFF,0xFE,0x02,0x80,0x02,0x88,0x04,0x88,
0x04,0x90,0x04,0xA0,0x08,0xC0,0x08,0x82,
0x11,0x82,0x16,0x82,0x20,0x7E,0x40,0x00};



void Lcd_Delay(unsigned int x);
void LcdWaitBusy(void);
void LcdWaitBusyAuto(void);
void LcdWrite_D(unsigned char x); //write data
void LcdWrite_I(unsigned char x); //write instruction
void LcdWrite_Com2(unsigned char x,unsigned char y,unsigned char z);
void LcdWrite_Com1(unsigned char x,unsigned char y);
void LcdWrite_Com0(unsigned char x);
void LcdWrite_HanZi(unsigned char* hanzi,unsigned int z);
void LcdWrite_Text(unsigned char w,unsigned int z);
void LcdInit(void);




/*************************************************************/
void main(void)
{

WDTCTL=WDTPW+WDTHOLD; // shut up watchdog
P4SEL&=~(BIT2+BIT3+BIT4+BIT5+BIT6+BIT7); // port function set I/O
port
P4DIR|=BIT2+BIT3+BIT4+BIT5+BIT6+BIT7; // port function set output
P4OUT|=BIT2+BIT3+BIT4+BIT5+BIT6; // port function set
P4OUT&=~BIT7; // select 8*8
LcdInit();
LcdWrite_Com0(0x9c);
LcdWrite_Text(0x13,0x0801); // line 1
LcdWrite_Text(0x36,0x0802);
LcdWrite_Text(0x11,0x0803);
LcdWrite_Text(0x12,0x0804);
LcdWrite_Text(0x18,0x0805);
LcdWrite_Text(0x0a,0x0806);
LcdWrite_Text(0x16,0x0807);
LcdWrite_Text(0x14,0x0808);
LcdWrite_HanZi(dian,0x0809);
LcdWrite_HanZi(zhen,0x080b);
LcdWrite_HanZi(ye,0x080d);
LcdWrite_HanZi(jing,0x080e);

LcdWrite_HanZi(lian,0x09e1); // line 2
LcdWrite_HanZi(xi,0x09e3);
LcdWrite_HanZi(ren,0x09e5);
LcdWrite_Text(0x1a,0x1861);
LcdWrite_HanZi(yang,0x09e9);
LcdWrite_HanZi(xiao,0x09eb);
LcdWrite_HanZi(llong,0x09ed);

LcdWrite_Text(0x10,0x189a); // line 3
LcdWrite_Text(0x17,0x189b);
LcdWrite_Text(0x15,0x189c);
LcdWrite_Text(0x15,0x189d);
LcdWrite_Text(0x0d,0x189e);
LcdWrite_Text(0x12,0x189a);
LcdWrite_Text(0x16,0x189b);
LcdWrite_Text(0x11,0x189c);
LcdWrite_Text(0x15,0x189d);
LcdWrite_Text(0x16,0x189e);
LcdWrite_Text(0x19,0x189c);
LcdWrite_Text(0x13,0x189d);
LcdWrite_Text(0x10,0x189e);

LcdWrite_Text(0x31,0x18b4); // line 4
LcdWrite_Text(0x31,0x18b5);
LcdWrite_Text(0x1a,0x18b6);
LcdWrite_Text(0x13,0x18b7);
LcdWrite_Text(0x17,0x18b8);
LcdWrite_Text(0x16,0x18b9);
LcdWrite_Text(0x10,0x18ba);
LcdWrite_Text(0x12,0x18bb);
LcdWrite_Text(0x17,0x18bc);
LcdWrite_Text(0x12,0x18bd);
LcdWrite_Text(0x17,0x18be);
LcdWrite_Text(0x17,0x18bf);

}
/**************************************************************/
void Lcd_Delay(unsigned int x) //time delay
{
while(x!=0)x--;
}
void LcdWrite_D(unsigned char x) //write date
{
P4OUT&=~lcdcd;
P4OUT|=lcdwr;
P4OUT&=~lcdce;
P4OUT&=~lcdwr;
P5DIR=0xff;
P5OUT=x;
P4OUT|=lcdce;
P4OUT|=lcdwr;
}
void LcdWrite_I(unsigned char x) //write instruction
{
P4OUT|=lcdcd;
P4OUT|=lcdwr;
P4OUT&=~lcdwr;
P4OUT&=~lcdce;
P5DIR=0xff;
P5OUT=x;
P4OUT|=lcdce;
P4OUT|=lcdwr;
}
void LcdWrite_Com2(unsigned char x,unsigned char y,unsigned char z)
{
LcdWaitBusy();
LcdWrite_D(x);
LcdWaitBusy();
LcdWrite_D(y);
LcdWaitBusy();
LcdWrite_I(z);
}
void LcdWrite_Com1(unsigned char x,unsigned char y)
{
LcdWaitBusy();
LcdWrite_D(x);
LcdWaitBusy();
LcdWrite_I(y);
}
void LcdWrite_Com0(unsigned char x)
{
LcdWaitBusy();
LcdWrite_I(x);
}
void LcdWaitBusy(void)
{
unsigned char x;
do
{
P4OUT|=lcdcd;
P4OUT&=~lcdce;
P4OUT|=lcdwr;
P4OUT&=~lcdrd;
P5DIR=0x00; //p5 set input
x=P5IN&0x03;
P4OUT|=lcdce;
P4OUT|=lcdrd;
}
while(x!=0x03); //mask the other status bits and test the busy bit
}
void LcdWaitBusyAuto(void)
{
unsigned char x;
do
{
P4OUT|=lcdcd;
P4OUT&=~lcdce;
P4OUT|=lcdwr;
P4OUT&=~lcdrd;
P5DIR=0x00; //p5 set input
x=P5IN&0x08;
P4OUT|=lcdce;
P4OUT|=lcdrd;
}
while(x!=0x08); //mask the other status bits and test the busy bit
}
void LcdInit(void)
{
unsigned int i;
P4OUT&=~lcdrst;
_NOP();
_NOP();
P4OUT|=lcdrst;
_NOP();
_NOP();
LcdWrite_Com2(0x00,0x00,0x21);
LcdWrite_Com2(0x00,0x00,0x22);
LcdWrite_Com2(0x00,0x00,0x24);
LcdWrite_Com2(0x00,0x18,0x40);
LcdWrite_Com2(0x1E,0x00,0x41);
LcdWrite_Com2(0x00,0x08,0x42);
LcdWrite_Com2(0x1E,0x00,0x43);
LcdWrite_Com0(0x80);
LcdWrite_Com0(0x9c);
LcdWrite_Com0(0xA0);
for(i=0;i<0x2000;i++) //clear lcd
{
LcdWrite_Com1(0x00,0xc0);
}
}
void LcdWrite_HanZi(unsigned char* hanzi,unsigned int z)
{
unsigned char i,x,y;
for(i=0;i<0x20;i++)
{
x=(unsigned char)(z&0x00ff);
y=(unsigned char)((z&0xff00)/0x100);
LcdWrite_Com2(x,y,0x24);
LcdWrite_Com1(hanzi[i],0xc0);
i++;
LcdWrite_Com1(hanzi[i],0xc0);
z=z+0x1e;
}
LcdWrite_Com2(0x00,0x00,0x21);
LcdWrite_Com2(0x00,0x00,0x24);
}
void LcdWrite_Text(unsigned char w,unsigned int z)
{
unsigned int x,y; //z=0x1800
x=(unsigned char)(z&0x00ff);
y=(unsigned char)((z&0xff00)/0x100);
LcdWrite_Com2(x,y,0x24);
LcdWrite_Com1(w,0xc0);
LcdWrite_Com2(0x00,0x00,0x21);
LcdWrite_Com2(0x00,0x00,0x24);
}

点评

请问D0~D7引脚如何接的  详情 回复 发表于 2012-7-28 16:12
 
 

回复

78

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
万分感谢!!
 
 
 

回复

79

帖子

0

TA的资源

一粒金砂(初级)

4
 
我的程序没有其他问题,为什么LcdWaitBusy,一直死循环?P5IN一直为0;谢谢
void LcdWaitBusy(void)
{
unsigned char x;
do
{
P4OUT|=lcdcd;
P4OUT&=~lcdce;
P4OUT|=lcdwr;
P4OUT&=~lcdrd;
P5DIR=0x00; //p5 set input
x=P5IN&0x03;
P4OUT|=lcdce;
P4OUT|=lcdrd;
}
 
 
 

回复

61

帖子

0

TA的资源

一粒金砂(初级)

5
 
是不是你的IAR嵌入式工作台有问题?
 
 
 

回复

69

帖子

0

TA的资源

一粒金砂(初级)

6
 
你指的是要重新安装IAR?
 
 
 

回复

70

帖子

0

TA的资源

一粒金砂(初级)

7
 
试试:
void LcdWaitBusy(void)
{
unsigned char x;
do
{
P4OUT|=lcdcd;
P4OUT&=~lcdce;
P4OUT|=lcdwr;
P4OUT&=~lcdrd;
P5DIR=0x00; //p5 set input
x=P5IN&0x03;
P4OUT|=lcdce;
P4OUT|=lcdrd;
}
while(退出条件)
}
 
 
 

回复

77

帖子

0

TA的资源

一粒金砂(初级)

8
 
谢谢,我也是这样的,我写丢了.还有,我想问,是不是T6963C只要接21脚就可以用了.??
 
 
 

回复

7

帖子

0

TA的资源

一粒金砂(中级)

9
 

回复 沙发 piaofu 的帖子

请问D0~D7引脚如何接的
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表