欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標(biāo)題: 基于SC95F8616單片機(jī)的中西文混排顯示 [打印本頁(yè)]

作者: jinglixixi    時(shí)間: 2020-7-18 08:29
標(biāo)題: 基于SC95F8616單片機(jī)的中西文混排顯示
前面介紹了區(qū)位法顯示漢字,但使用起來(lái)多少有些不便,為了便于中西文混排,這里介紹用指針來(lái)實(shí)現(xiàn)混排顯示的方法。
其顯示效果如圖1所示,其中首行顯示的是內(nèi)碼,次行顯示是的內(nèi)容。

1混排顯示

混排顯示主程序?yàn)椋?/font>
  1. void  main(void)
  2. {
  3.          no=0;
  4.          x=0;
  5.          OLED_Init();
  6.          OLED_Clear();
  7.          LcdShowString(0,0,"啊A阿",0,1);
  8.          while(1);
  9. }
復(fù)制代碼

混排顯示函數(shù)為:
  1. void LcdShowString(uint32_t x,uint32_t y,uint8_t *pucCode,uint32_t color,uint32_t bgcolor)
  2. {
  3.           uint32_t x_bak=x;
  4.           uint8_t  u,v,no,p;
  5.           p=x;
  6.           while(*pucCode)
  7.           {
  8.                              if(*pucCode & 0x80)
  9.                              {
  10.                                         u=*pucCode;
  11.                                         v=(u&0xf0)>>4;
  12.                                         if(v<10) OLED_ShowChar (x,y,v+'0',16);
  13.                                         else OLED_ShowChar (x,y,v+55,16);

  14.                                         x=x+8;
  15.                                         v=(u&0x0f);
  16.                                         if(v<10) OLED_ShowChar (x,y,v+'0',16);
  17.                                         else OLED_ShowChar (x,y,v+55,16);

  18.                                         x=x+8;
  19.                                         u=*(++pucCode);
  20.                                         no=u-161;
  21.                                        
  22.                                         v=(u&0xf0)>>4;
  23.                                         if(v<10) OLED_ShowChar (x,y,v+'0',16);
  24.                                         else OLED_ShowChar (x,y,v+55,16);

  25.                                         x=x+8;
  26.                                         v=(u&0x0f);
  27.                                         if(v<10) OLED_ShowChar (x,y,v+'0',16);
  28.                                         else OLED_ShowChar (x,y,v+55,16);

  29.                                         *(++pucCode);
  30.                                         x+=8;
  31.                                         OLED_ShowCHinesey(p,y+2, no*2);
  32.                                         p+=16;
  33.                               }
  34.                              else
  35.                              {
  36.                                         u=*pucCode;
  37.                                         v=(u&0xf0)>>4;
  38.                                         if(v<10) OLED_ShowChar (x,y,v+'0',16);
  39.                                         else OLED_ShowChar (x,y,v+55,16);
  40.                                         x+=8;

  41.                                         v=(u&0x0f);
  42.                                         if(v<10) OLED_ShowChar (x,y,v+'0',16);
  43.                                         else OLED_ShowChar (x,y,v+55,16);
  44.                                         x+=8;
  45.                                         OLED_ShowChar(p,y+2,u,16);
  46.                                         p+=8;
  47.                                         *(++pucCode);
  48.                              }

  49.                              if(x>113)
  50.                              {
  51.                                        x = x_bak;
  52.                              }
  53.           }
  54. }
復(fù)制代碼

2超長(zhǎng)顯示





歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1