野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10757|回复: 4

关于液晶屏显示中文字符的问题

[复制链接]
发表于 2021-10-10 19:55:08 | 显示全部楼层 |阅读模式
有没有大佬帮小弟看一下这段代码写的哪有问题,这个代码是用来从字库里获取中文字符的字模数据
  1. void GetGB2312Mod(uint8_t *readbuffer,char* Char)
  2. {
  3.         static uint8_t read=0;
  4.         uint8_t i=0;
  5.         uint8_t firstbyte,high8bit,low8bit;
  6.         if(read==0)
  7.         {
  8.                 spi_init();
  9.                 read=1;
  10.         }
  11.         high8bit=*Char;
  12.         low8bit=*(Char+1);
  13.         firstbyte=((high8bit-0xa1)*94+low8bit-0xa1)*16*16/8;
  14.         flash_readbuffer((387*4096)+firstbyte,readbuffer,32);
  15.         for(i=0;i<32;i++)
  16.         {
  17.                 printf("0x%x ",readbuffer[i]);
  18.         }
  19. }


  20. void flash_readbuffer(uint32_t address,uint8_t *data,uint16_t count)
  21. {
  22.         CS_L;
  23.         spi_writebyte(0x03);
  24.         spi_writebyte((address&0xff0000)>>16);
  25.         spi_writebyte((address&0xff00)>>8);
  26.         spi_writebyte(address&0xff);
  27.         while(count--)
  28.         {
  29.                 *data=spi_readbyte();
  30.                 data++;
  31.         }
  32.         CS_H;
  33. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2021-10-10 19:59:06 | 显示全部楼层
我想显示一个"你"字,字的字模为
{0x08,0x80,0x08,0x80,0x08,0x80,0x11,0xFE,0x11,0x02,0x32,0x04,0x34,0x20,0x50,0x20,0x91,0x28,0x11,0x24,0x12,0x24,0x12,0x22,
0x14,0x22,0x10,0x20,0x10,0xA0,0x10,0x40}
而我读出来的却是
{0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0}
回复 支持 反对

使用道具 举报

发表于 2021-10-11 16:00:41 | 显示全部楼层
lyp82nxb 发表于 2021-10-10 19:59
我想显示一个"你"字,字的字模为
{0x08,0x80,0x08,0x80,0x08,0x80,0x11,0xFE,0x11,0x02,0x32,0x04,0x34,0x2 ...

重新刷下外部FLASH
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-10-11 16:17:37 | 显示全部楼层

刷过了,还是不行
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-10-11 16:48:13 | 显示全部楼层

我找到问题了,我把字模首地址定义成8位的了。。。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-5-23 11:24 , Processed in 0.030007 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表