在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
芯片精品文章合集(500篇!) 创芯人才网--重磅上线啦!
查看: 6445|回复: 1

[求助] T6963C 汉字显示问题求助

[复制链接]
发表于 2010-4-8 10:15:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 hpdell 于 2010-4-8 11:28 编辑

现在我用T6963的控制器显示汉字时,显示出来的汉字却是12*16的了,不翼而飞的就少了8个字节,,如果是显示字符就会少4个字节,还有就是显示x坐标如果超过15,他会出来两个汉字,而这个15的坐标实际的显示位置还没有到最右边,不知道是为什么???望高手指点,
我的QQ:519212866
//以8*8字符计算,显示屏横向、纵向可以显示的字符个数
//屏是128*128的点阵。
/*
这几个地址的参数该如何设置才正确!!!!!!!!!
OutPortCom3(0x00,0x00,0x21);
OutPortCom3(0x00,0x00,0x22);
OutPortCom3(0x00,0x00,0x24);
OutPortCom3(0x00,0x00,0x40);  //文本首址,
OutPortCom3(0x10,0x00,0x41); //文本区域,每行显示16个字符

OutPortCom3(0x00,0x00,0x42); //图形首址,此处高位地址如果偏移0x01,那么,图形地址就会上移动16行,一次类推
OutPortCom3(0x10,0x00,0x43); //图形区域
*/

//程序如下:::



#include <stc12c5a60s2.h>  //这个STC公司的1T时钟单片机
#include<intrins.h>   //本征函数是指编译时直接将固定的代码插入当前行【如延时_nop_】
#include <string.h>
#include<absacc.h>
#include<math.h>

#define LineChar 16 //一行16个字符(8*8)
#define ColumnChar 16 //总共16列  
#define uchar unsigned char
#define uint unsigned int
#define HIGH 1
#define LOW  0
#define LcdDataPort P0
sbit CD=P2^4;
sbit Wr=P2^5;
sbit Rd=P2^6;
sbit RST=P2^0;
sbit LCD_CS = P2^7;
sbit LCD_PSB = P2^1;  //字体选择
#define LCD_RST RST
#define LCD_CD CD
#define LCD_WR Wr
#define LCD_RD Rd
static const uchar code HZTable[][32]=
{
//国
0x00,0x00,0x1F,0xFF,0x10,0x01,0x10,0x01,0x17,0xFD,0x10,0x41,0x10,0x41,0x13,0xF9,
0x10,0x41,0x10,0x51,0x10,0x49,0x17,0xFD,0x10,0x01,0x10,0x01,0x1F,0xFF,0x10,0x01,
//家
//0x01,0x00,0x00,0x80,0x3F,0xFF,0x20,0x02,0x40,0x04,0x1F,0xFC,0x02,0x00,0x0D,0x08,
//0x31,0x98,0x02,0xA0,0x0C,0xC0,0x31,0xA0,0x02,0x98,0x0C,0x87,0x32,0x82,0x01,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
//园
0x00,0x00,0x1F,0xFF,0x10,0x01,0x13,0xF9,0x10,0x01,0x10,0x01,0x17,0xFD,0x11,0x21,
0x11,0x21,0x11,0x25,0x11,0x25,0x12,0x1D,0x14,0x01,0x10,0x01,0x1F,0xFF,0x10,0x01,
//我
0x02,0x40,0x07,0x48,0x3C,0x44,0x04,0x44,0x04,0x40,0x7F,0xFF,0x04,0x40,0x04,0x44,
0x05,0x44,0x06,0x48,0x0C,0x30,0x34,0x20,0x04,0x52,0x04,0x8A,0x15,0x06,0x08,0x02,
//们
0x02,0x40,0x02,0x20,0x02,0x2F,0x04,0x81,0x04,0x81,0x0C,0x81,0x14,0x81,0x24,0x81,
0x04,0x81,0x04,0x81,0x04,0x81,0x04,0x81,0x04,0x81,0x04,0x81,0x04,0x85,0x04,0x82,
//难
0x00,0x10,0x00,0x48,0x7E,0x48,0x02,0x7F,0x22,0xC8,0x22,0xC8,0x15,0x7E,0x14,0x48,
0x08,0x48,0x08,0x7E,0x14,0x48,0x12,0x48,0x22,0x48,0x40,0x7F,0x00,0x40,0x00,0x40,
//圆
0x00,0x00,0x1F,0xFF,0x10,0x01,0x11,0xF1,0x11,0x11,0x11,0xF1,0x10,0x01,0x13,0xF9,
0x12,0x09,0x12,0x49,0x12,0x49,0x12,0xA9,0x11,0x11,0x12,0x09,0x1F,0xFF,0x10,0x01,
//梦
0x04,0x10,0x04,0x10,0x3F,0x7E,0x04,0x10,0x0E,0x38,0x15,0x57,0x24,0x92,0x06,0x10,
0x03,0xFC,0x04,0x08,0x0A,0x10,0x11,0x20,0x00,0xC0,0x01,0x80,0x06,0x00,0x38,0x00,
};

unsigned char BUSY()
{
unsigned char address_cmd;
  LcdDataPort = 0xFF;
//  LCD_WR = HIGH;
  LCD_CD = HIGH;
  LCD_CS = LOW;     
  LCD_RD = LOW;  
  address_cmd = LcdDataPort;  
  LCD_RD = HIGH;
  LCD_CS = HIGH;
  return (address_cmd);
}  

//指令,数据 读写状态检查
void RWCheck()   {  while (( BUSY()&0x03)!=0x03) ; }
void  OutPortData(unsigned char dat)
{
  RWCheck();
LcdDataPort =  dat;
LCD_RD = HIGH;
LCD_CD = LOW;  //关键
LCD_CS = LOW;  
LCD_WR = LOW;  //关键
LCD_WR = HIGH;    //关键
LCD_CD = HIGH;   //关键
LCD_CS = HIGH;
}

void OutPortCom1(unsigned char command)
{
  RWCheck();
LcdDataPort =  command;
LCD_RD = HIGH;
LCD_CD = HIGH;  //关键
LCD_WR = LOW;  //关键
LCD_CS = LOW;   
LCD_WR = HIGH;    //关键
LCD_CD = HIGH;   //关键
LCD_CS = HIGH;
}

//写有 2个参数命令
#define OutPortCom2(dat, command) { OutPortData(dat); OutPortCom1(command); }
//写有 3 个参数命令
#define OutPortCom3(data1, data2, command) { OutPortData(data1); OutPortData(data2); OutPortCom1(command);}

void ClearScreen()
{
  unsigned int i;   // 清显示 RAM 区 0000h--2000h (8k)
  OutPortCom3(0x00,0x00,0x24); //设置指针地址0000H
  OutPortCom1(0xb0); //设置自动写状态
  for(i=0x00;i<0x2000;i++) OutPortData(0x00); // data=0;
  OutPortCom1(0xb2); // 自动写结束
}
/* lcd初始化 */
void LcdInit(void)
{
OutPortCom3(0x00,0x00,0x21);
OutPortCom3(0x00,0x00,0x22);
OutPortCom3(0x00,0x00,0x24);
OutPortCom3(0x00,0x00,0x40);  /*文本首址*/
OutPortCom3(0x10,0x00,0x41); /*文本区域*/  //每行显示16个字符
OutPortCom3(0x00,0x00,0x42); /*图形首址*/ //此处高位地址如果偏移0x01,那么,图形地址就会上移动16行,一次类推
OutPortCom3(0x10,0x00,0x43); /*图形区域*/
OutPortCom1(0x88); /*显示方式*/ //内部字符发生器
OutPortCom1(0x98); /*显示开关*/ //图形开,文本关
OutPortCom1(0xa7); /*光标形状*/

ClearScreen();
}

/* 设定图形x,y值*/
void AddPointer(unsigned char x,unsigned char y)
{
  unsigned int Addr;
  unsigned char addrx,addry;
  Addr=((uint)(y)*16)+x;  //如果初始设置地址0x42的高地址没有设置,那么此处就不用再加上256了【如果是一个字节】。即此处地址与0x42的地址相关
//  Addr=((uint)(y)*16)+x+256; //16表示是16行,256表示是一个字节
  addrx  =  (uchar)((Addr)&0xff);
  addry =  (uchar)(Addr>>8);
  OutPortCom3(addrx,addry,0x24);
}


void ShowHZ_Three(uchar x,uchar y,uchar hzcode)
{
   unsigned char i,j;
   uchar bian = 0,bianx=0,biany=0;   
   for(i=0;i<16;i++)
   {
      for(j=0;j<2;j++)
   {
     //   AddPointer(j+x,y*8+i); //y=8bit
   bian =  i*2+j;
  bianx = j+x;
  biany = y+i;
   AddPointer(bianx,biany);      //y=1bit   
  OutPortCom2(HZTable[hzcode][bian], 0xc0); //显示当前一行
   }
   }      
}   
void main()
{
    uchar k=0;
// uart1_ini();
// LCD_CS=0;
LCD_PSB=0; //0是8*8,   1是6*8
    LcdInit();
ClearScreen();
  while(1)
   {
     ShowHZ_Three(14,0,3);   //显示汉字“我” x坐标是14,y坐标是0,x坐标时,显示的汉字还没有到最右边,如果这个坐标大于等
//于15,他会出来两个汉字【当然他会自动换行来显示】  请问这个是什么问题或是什么原因造成的???????
     
    }
}
照片 004.jpg
照片 001.jpg
照片 002.jpg
 楼主| 发表于 2010-6-18 09:42:06 | 显示全部楼层
怎么没有人回复啊?????????????
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-26 19:51 , Processed in 0.022188 second(s), 10 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表