打印
[开发工具]

用最新库玩转智林STM32开发板(之八)------在真彩屏上显示汉字

[复制链接]
3142|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ddllxxrr|  楼主 | 2009-5-2 08:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
大家好!好久不发是因为我出差了哈,过几天还出,慢慢来吧
有智林板的可以把所有文件考到一个目录下边,工程非常简单只包括三个文件
main.C//主文件
TFT018.c//显示有关文件
STM32F10XR.LIB//这个文件在MDK目录下边很好找
智林STM32开发板的汉显很简便实用用一个取模软件取模,然后用指针找字模
然后显示出来,哈哈......也实用的
希望大家多上我的店来坐坐,http://shop35738797.taobao.com/
很好的买家,合作非常愉快,希望再次惠顾小店,若白天不在晚上一定在的,大家着急请拍下,
付款发货的
以下是智林板的汉字字模文件:
// ------------------  汉字字模的数据结构定义 ------------------------ //
struct typFNT_GB16                 // 汉字字模数据结构 
{
       unsigned char Index[3];               // 汉字内码索引 
       char Msk[32];                       // 点阵码数据 
};
/////////////////////////////////////////////////////////////////////////
// 汉字字模表                                                          //
// 汉字库: 宋体16.dot,横向取模左高位,数据排列:从左到右从上到下         //
/////////////////////////////////////////////////////////////////////////
const struct typFNT_GB16 codeGB_16[] =          // 数据表 
{
"智", 0x00,0x00,0x18,0x00,0x11,0x22,0x1F,0xBF,0x64,0x22,0x05,0x22,0x7F,0xA2,0x0A,0x3E,
      0x09,0xA2,0x10,0x80,0x6F,0xF8,0x08,0x08,0x0F,0xF8,0x08,0x08,0x0F,0xF8,0x08,0x08,
"林", 0x00,0x00,0x0C,0x18,0x08,0x10,0x0A,0x12,0x7F,0x7F,0x08,0x10,0x18,0x30,0x18,0x58,
      0x2C,0x54,0x2A,0x54,0x4A,0x92,0x08,0x91,0x09,0x10,0x08,0x10,0x08,0x10,0x08,0x10,
"测", 0x00,0x00,0x20,0x02,0x1B,0xE2,0x0A,0x2A,0x02,0xAA,0x42,0xAA,0x2A,0xAA,0x2A,0xAA,
      0x0A,0xAA,0x12,0xAA,0x12,0xAA,0x72,0xAA,0x10,0x82,0x11,0x42,0x12,0x2A,0x14,0x24,
"控", 0x00,0x00,0x18,0x30,0x11,0x22,0x11,0xFF,0x7D,0x52,0x12,0x54,0x10,0x91,0x14,0x8F,
      0x19,0x00,0x70,0x04,0x51,0xFE,0x10,0x20,0x10,0x20,0x10,0x22,0x73,0xFF,0x20,0x00,
"技", 0x00,0x00,0x18,0x30,0x10,0x20,0x10,0x22,0x7D,0xFF,0x10,0x20,0x10,0x24,0x15,0xFE,
      0x18,0x84,0x70,0x44,0x50,0x48,0x10,0x30,0x10,0x10,0x10,0x28,0x70,0x44,0x21,0x83,
"术", 0x00,0x00,0x00,0xC0,0x00,0x90,0x00,0x88,0x00,0x8A,0x3F,0xFF,0x01,0xC0,0x01,0xA0,
      0x02,0xA0,0x02,0x90,0x04,0x90,0x08,0x88,0x10,0x84,0x60,0x83,0x00,0x80,0x00,0x80,
"研", 0x00,0x00,0x08,0x42,0x7D,0xEF,0x10,0x44,0x10,0x44,0x10,0x44,0x24,0x44,0x3E,0x54,
      0x64,0x6F,0x25,0xC4,0x25,0x44,0x3C,0x44,0x24,0x44,0x20,0x84,0x00,0x84,0x01,0x04,
"究", 0x00,0x00,0x01,0x80,0x21,0x04,0x3F,0xFE,0x20,0x04,0x4C,0x69,0x08,0x41,0x10,0x3F,
      0x63,0x00,0x02,0x20,0x3F,0xF0,0x04,0x20,0x04,0x22,0x08,0x22,0x10,0x23,0x60,0x1E,
"所", 0x00,0x00,0x27,0x4E,0x38,0x70,0x20,0x40,0x21,0x40,0x3F,0x42,0x21,0x7F,0x21,0x44,
      0x21,0x44,0x3F,0x44,0x21,0x44,0x20,0x44,0x20,0x84,0x40,0x84,0x40,0x84,0x41,0x04,
"开", 0x00,0x00,0x00,0x04,0x3F,0xFE,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0x12,
      0x7F,0xFF,0x04,0x10,0x04,0x10,0x04,0x10,0x08,0x10,0x08,0x10,0x10,0x10,0x20,0x10,
"发", 0x00,0x00,0x01,0x00,0x11,0x10,0x11,0x08,0x21,0x02,0x3F,0xFF,0x02,0x00,0x02,0x08,
      0x03,0xFC,0x06,0x08,0x0A,0x10,0x11,0x20,0x20,0xC0,0x41,0x30,0x06,0x0F,0x38,0x02,
"板", 0x00,0x00,0x0C,0x82,0x08,0xFF,0x08,0x80,0x7E,0x80,0x18,0x82,0x18,0xFF,0x2C,0xA2,
      0x2A,0xA2,0x2A,0x92,0x48,0x94,0x08,0x88,0x09,0x14,0x09,0x14,0x09,0x22,0x0A,0x41,
"电", 0x02,0x00,0x02,0x00,0x02,0x10,0x7F,0xF8,0x42,0x10,0x42,0x10,0x7F,0xF0,0x42,0x10,
      0x42,0x10,0x7F,0xF0,0x42,0x10,0x02,0x00,0x02,0x04,0x02,0x04,0x01,0xFC,0x00,0x00,
"压", 0x00,0x08,0x3F,0xFC,0x20,0x80,0x20,0x80,0x20,0x80,0x20,0x80,0x20,0x88,0x2F,0xFC,
      0x20,0x80,0x20,0xA0,0x20,0x98,0x20,0x88,0x40,0x80,0x40,0x84,0x9F,0xFE,0x00,0x00,
};

以下是主程序文件:

int main(void)
{
#ifdef DEBUG
  debug();
#endif
  /* System Clocks Configuration */
  RCC_Configuration();
  /* NVIC Configuration */
  NVIC_Configuration();
  
  /* GPIO Configuration */
  GPIO_Configuration();

  /* Time base configuration */
  TIM_TimeBaseStructure.TIM_Period = 0x5000;          
  TIM_TimeBaseStructure.TIM_Prescaler = 0x00;       
  TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;    
  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; 
  
  TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
  /* Output Compare Toggle Mode configuration: Channel1 */
  TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
  TIM_OCInitStructure.TIM_Pulse =CCR3_Val ;
  TIM_OC3Init(TIM2, &TIM_OCInitStructure);
   
  /* TIM enable counter */
  TIM_Cmd(TIM2, ENABLE);
  LCD_Init();
  LCD_Clear_Screen(Blue);
  
  while(1)
  {
   
  for(;;) {
   
          Font = 0;
    LCD_PutString(30,10,"STM32F 开发板",Cyan,Blue);
    LCD_PutString(12,30,"STM32F EVAL BOARD",Blue2,Blue);
    Font = 1;
    LCD_PutString(38,46,"Version 1.0",Green,Blue);
    Font = 0;
    LCD_PutString(10,60,"智林测控技术研究所",Yellow,Blue);
    LCD_PutString(30,80,"ZERO Research",Yellow,Blue);
    LCD_PutString(36,100,"www.the0.net",Magenta,Blue);
   }    
  }  
}


为了方便有智林板的客户:我特意打了包,到时一起考到一个目录,建一下工程就可以了,HEX文件是编译好的,可以直接下

相关链接:https://bbs.21ic.com/upfiles/img/20095/20095281113152.rar
沙发
ddllxxrr|  楼主 | 2009-5-2 14:03 | 只看该作者

刚才少压个文件名也不对补上哈

使用特权

评论回复
板凳
McuPlayer| | 2009-5-2 14:14 | 只看该作者

楼主的做法跟我的做法类似

函数封装;LCD_Putstring我用的是单色LCM所以没有颜色参数

另外建议把字库的点阵数据和索引分开
你现在混合是34个字节,如果用只有点阵的32个字节,寻址时候就可以用索引做shift然后加上基地址了
另外索引单独,可以很方便优化检索方式,而不必动字库,比如最简单有效的对半查找

使用特权

评论回复
地板
ddllxxrr|  楼主 | 2009-5-2 21:19 | 只看该作者

恩,楼上说的有道理,不过我的单色屏,是向你那样做的

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2399

主题

6963

帖子

68

粉丝