Arduino中文取模定义规范和使用

   日期:2021-02-28     浏览:98    评论:0    
核心提示:Arduino取模汉字定义规范和使用1.以数组形式定义汉字取模后的数据。static unsigned char weather_icon[8][180]={ { 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,

Arduino取模定义规范和使用

esp8266气象站资源链接(包含所需库)

ESP8266气象站

1.以数组形式定义汉字图片取模后的数据。

static unsigned char weather_icon[8][180]={ 
  {    0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
      0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,
      0xE0,0x3F,0x00,0xF0,0x00,0xF0,0xFF,0x00,0xF0,0x00,0x38,0xC0,0x01,0xF0,0x00,0x0C,0x00,0x03,
      0xF0,0x00,0x06,0x00,0x06,0xF0,0x00,0x07,0x00,0x0E,0xF0,0xE0,0x03,0x00,0x0C,0xF0,0xF0,0x03,
      0x00,0x0C,0xF0,0x38,0x00,0x00,0x18,0xF0,0x0C,0x00,0x00,0xF8,0xF0,0x0E,0x00,0x00,0xF8,0xF1,
      0x06,0x00,0x00,0x80,0xF3,0x06,0x00,0x00,0x00,0xF7,0x06,0x00,0x00,0x00,0xF6,0x06,0x00,0x00,
      0x00,0xF6,0x06,0x00,0x00,0x00,0xF6,0x06,0x00,0x00,0x00,0xF6,0x0E,0x00,0x00,0x00,0xF6,0x0C,
      0x00,0x00,0x00,0xF7,0x38,0x00,0x00,0x80,0xF3,0xF0,0xFF,0xFF,0xFF,0xF1,0xE0,0xFF,0xFF,0xFF,
      0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,
      0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0},
      
  {    0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
      0x00,0xF0,0x00,0x80,0x19,0x00,0xF0,0x00,0x80,0x1F,0x00,0xF0,0x00,0x00,0x0F,0x00,0xF0,0x00,
      0x00,0x06,0x00,0xF0,0x00,0x00,0x06,0x00,0xF0,0x80,0x01,0x06,0x18,0xF0,0x80,0x01,0x06,0x18,
      0xF0,0x80,0x01,0x06,0x18,0xF0,0xE0,0x83,0x1F,0x7E,0xF0,0xE0,0xFF,0xF9,0x7F,0xF0,0x00,0xFC,
      0xF0,0x03,0xF0,0x00,0x70,0xE0,0x00,0xF0,0x00,0x30,0xC0,0x00,0xF0,0x00,0x30,0xC0,0x00,0xF0,
      0x00,0x30,0xC0,0x00,0xF0,0x00,0x30,0xC0,0x00,0xF0,0x00,0x70,0xE0,0x00,0xF0,0x00,0xFC,0xF0,
      0x03,0xF0,0xE0,0xFF,0xF9,0x7F,0xF0,0xE0,0x87,0x1F,0x7C,0xF0,0x80,0x01,0x06,0x18,0xF0,0x80,
      0x01,0x06,0x18,0xF0,0x80,0x01,0x06,0x18,0xF0,0x00,0x00,0x06,0x00,0xF0,0x00,0x00,0x06,0x00,
      0xF0,0x00,0x00,0x0F,0x00,0xF0,0x00,0x80,0x1F,0x00,0xF0,0x00,0x80,0x19,0x00,0xF0,0x00,0x00,
      0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0},
      
  {    0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
      0x00,0xF0,0x00,0xC0,0x3F,0x00,0xF0,0x00,0xF0,0xFF,0x00,0xF0,0x00,0x38,0xC0,0x01,0xF0,0x00,
      0x1C,0x80,0x03,0xF0,0x00,0x0C,0x00,0x03,0xF0,0x00,0x06,0x00,0x06,0xF0,0xE0,0x07,0x00,0x06,
      0xF0,0xF0,0x03,0x00,0x04,0xF0,0x38,0x00,0x00,0x1C,0xF0,0x18,0x00,0x00,0xFC,0xF0,0x0C,0x00,
      0x00,0xF8,0xF1,0x0C,0x00,0x00,0x80,0xF1,0x0C,0x00,0x00,0x00,0xF3,0x0C,0x00,0x00,0x00,0xF3,
      0x0C,0x00,0x00,0x00,0xF3,0x18,0x30,0x0C,0x03,0xF3,0x38,0x30,0x0C,0x83,0xF1,0x70,0x30,0x0C,
      0xC3,0xF1,0x60,0x18,0x86,0xC1,0xF0,0x00,0x18,0x86,0x01,0xF0,0x00,0x18,0x86,0x01,0xF0,0x00,
      0x1C,0xC7,0x01,0xF0,0x00,0x0C,0xC3,0x00,0xF0,0x00,0x0C,0xC3,0x00,0xF0,0x00,0x00,0x03,0x00,
      0xF0,0x00,0x80,0x01,0x00,0xF0,0x00,0x80,0x01,0x00,0xF0,0x00,0x80,0x01,0x00,0xF0,0x00,0x00,
      0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0},
      
  {    0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
      0x00,0xF0,0x00,0x00,0x38,0x00,0xF0,0x80,0x03,0x30,0x00,0xF0,0x80,0x01,0x20,0x00,0xF0,0x80,
      0x00,0x00,0x00,0xF0,0x00,0xE0,0x07,0x00,0xF0,0x00,0xF8,0x0F,0x00,0xF0,0x00,0x1C,0x1C,0x00,
      0xF0,0x00,0x0E,0x30,0x00,0xF0,0x00,0x06,0x70,0x00,0xF0,0x00,0x07,0x60,0x08,0xF0,0x00,0x03,
      0xC0,0x18,0xF0,0x08,0x03,0xC0,0x08,0xF0,0x0C,0xC3,0x7F,0x00,0xF0,0x08,0xE3,0xFF,0x00,0xF0,
      0x00,0x7E,0xE0,0x00,0xF0,0x00,0x1E,0x80,0x01,0xF0,0x00,0x1C,0x80,0x03,0xF0,0x00,0x0E,0x00,
      0x03,0xF0,0xC0,0x0F,0x00,0x03,0xF0,0xE0,0x07,0x00,0x03,0xF0,0x70,0x00,0x00,0x1F,0xF0,0x38,
      0x00,0x00,0x7F,0xF0,0x38,0x00,0x00,0xFE,0xF0,0x38,0x00,0x00,0xE0,0xF1,0x38,0x00,0x00,0xC0,
      0xF1,0x70,0x00,0x00,0xC0,0xF1,0xE0,0xFF,0xFF,0xFF,0xF0,0xC0,0xFF,0xFF,0x7F,0xF0,0x00,0xFE,
      0xFF,0x1F,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0},
      
  {    0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
      0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x06,0x00,0xF0,0x00,0x00,0x0F,0x00,0xF0,0x00,
      0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,
      0xF0,0xC0,0x81,0x1F,0x38,0xF0,0xC0,0xC0,0x3F,0x30,0xF0,0x40,0xE0,0x70,0x20,0xF0,0x00,0x30,
      0xC0,0x00,0xF0,0x00,0x38,0xC0,0x01,0xF0,0x00,0x18,0x80,0x01,0xF0,0x00,0x18,0x80,0x01,0xF0,
      0x00,0x18,0x80,0x01,0xF0,0x00,0x18,0x80,0x01,0xF0,0x00,0x38,0xC0,0x01,0xF0,0x00,0x30,0xC0,
      0x00,0xF0,0x40,0xE0,0x70,0x20,0xF0,0xC0,0xC0,0x3F,0x30,0xF0,0xC0,0x81,0x1F,0x38,0xF0,0x00,
      0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,
      0xF0,0x00,0x00,0x0F,0x00,0xF0,0x00,0x00,0x06,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,
      0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0},
      
  {    0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
      0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x80,0x1F,0x00,0xF0,0x00,0xE0,0x7F,0x00,0xF0,0x00,
      0x70,0xE0,0x00,0xF0,0x00,0x18,0x80,0x01,0xF0,0x00,0x0C,0x00,0x03,0xF0,0x00,0x04,0x00,0x02,
      0xF0,0xC0,0x07,0x00,0x06,0xF0,0xE0,0x03,0x00,0x04,0xF0,0x70,0x00,0x00,0x04,0xF0,0x18,0x00,
      0x00,0x7C,0xF0,0x1C,0x00,0x00,0xFC,0xF0,0x0C,0x00,0x00,0xC0,0xF1,0x0C,0x00,0x00,0x80,0xF3,
      0x0C,0x00,0x00,0x00,0xF3,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
      0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0xF0,0xFF,0x8F,0xFF,0xF0,0xF0,0xFF,0x8F,0xFF,0xF0,0x00,
      0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,
      0xF0,0xF0,0xF8,0xFF,0xFF,0xF0,0xF0,0xF8,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,
      0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0},
      
  {    0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,
      0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x18,0x00,0xF0,0x00,0x06,0x3C,0x00,0xF0,0x00,
      0x0F,0xFF,0x00,0xF0,0x80,0x0F,0x7E,0x00,0xF0,0xC0,0x0D,0x3C,0x00,0xF0,0xC0,0x0C,0x7E,0x00,
      0xF0,0x60,0x0C,0x66,0x00,0xF0,0x60,0x0C,0x00,0x00,0xF0,0x30,0x0C,0x00,0x00,0xF0,0x30,0x1C,
      0x00,0x00,0xF0,0x30,0x18,0x00,0x00,0xF0,0x30,0x18,0x00,0x08,0xF0,0x30,0x30,0x00,0x3E,0xF0,
      0x30,0x70,0x00,0x1C,0xF0,0x30,0xE0,0x00,0x14,0xF0,0x30,0xC0,0x01,0x00,0xF0,0x30,0x80,0x03,
      0x00,0xF0,0x30,0x00,0x07,0x00,0xF0,0x60,0x00,0x3E,0x00,0xF0,0x60,0x00,0xF8,0x1F,0xF0,0xC0,
      0x00,0xE0,0x3F,0xF0,0xC0,0x01,0x00,0x38,0xF0,0x80,0x03,0x00,0x1C,0xF0,0x00,0x07,0x00,0x0E,
      0xF0,0x00,0x1E,0x80,0x07,0xF0,0x00,0xF8,0xFF,0x01,0xF0,0x00,0xE0,0x7F,0x00,0xF0,0x00,0x00,
      0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0},
      
  {    0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x0C,0x00,0xF0,0x00,0x00,0x0E,
      0x00,0xF0,0x00,0x00,0x0F,0x00,0xF0,0x00,0x00,0x0F,0x00,0xF0,0x00,0x80,0x0F,0x00,0xF0,0x00,
      0x80,0x1D,0x00,0xF0,0x00,0xC0,0x19,0x00,0xF0,0x00,0xC0,0x18,0x00,0xF0,0x00,0xC0,0x30,0x00,
      0xF0,0x00,0xC0,0x70,0x00,0xF0,0x00,0xC0,0xE0,0x00,0xF0,0x00,0x80,0xC1,0x01,0xF0,0x00,0x80,
      0x81,0x03,0xF0,0x00,0x80,0x07,0x1F,0xF0,0x00,0xC0,0x3F,0xFC,0xF3,0x00,0xE0,0x7F,0xF0,0xF3,
      0x00,0x70,0xE0,0xE0,0xF1,0x00,0x38,0xC0,0xF9,0xF0,0x00,0x18,0x80,0x3F,0xF0,0x00,0x1E,0x80,
      0x0F,0xF0,0xC0,0x0F,0x00,0x03,0xF0,0xE0,0x0F,0x00,0x03,0xF0,0x70,0x00,0x00,0x07,0xF0,0x30,
      0x00,0x00,0x7F,0xF0,0x30,0x00,0x00,0xFE,0xF0,0x30,0x00,0x00,0xC0,0xF0,0x30,0x00,0x00,0xC0,
      0xF0,0x70,0x00,0x00,0xC0,0xF0,0xE0,0xFF,0xFF,0xFF,0xF0,0xC0,0xFF,0xFF,0x7F,0xF0,0x00,0xFE,
      0xFF,0x1F,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0xF0}
  };

2.以单个汉字取模数据定义。

const unsigned char xing[32] U8X8_PROGMEM = { //[]中的数值可写也不写
  0x00, 0x00, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x80, 0x00, 0x88, 0x00,
  0xF8, 0x1F, 0x84, 0x00, 0x82, 0x00, 0xF8, 0x0F, 0x80, 0x00, 0x80, 0x00, 0xFE, 0x3F, 0x00, 0x00
};  

const unsigned char qi[] U8X8_PROGMEM = { 
  0x44, 0x00, 0x44, 0x3E, 0xFE, 0x22, 0x44, 0x22, 0x44, 0x22, 0x7C, 0x3E, 0x44, 0x22, 0x44, 0x22,
  0x7C, 0x22, 0x44, 0x3E, 0x44, 0x22, 0xFF, 0x22, 0x20, 0x21, 0x44, 0x21, 0x82, 0x28, 0x41, 0x10
};  

const unsigned char Year1[] U8X8_PROGMEM = { 
  0x04, 0x00, 0x04, 0x00, 0xFC, 0x07, 0x42, 0x00, 0x41, 0x00, 0xFC, 0x03,
  0x44, 0x00, 0x44, 0x00, 0xFF, 0x07, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00
};

const unsigned char yue[24] U8X8_PROGMEM = { 
  0x00, 0x00, 0xFC, 0x03, 0x04, 0x02, 0x04, 0x02, 0xFC, 0x03, 0x04, 0x02,
  0x04, 0x02, 0xFC, 0x03, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x81, 0x03
};
const unsigned char ri[24] U8X8_PROGMEM = { 
  0x00, 0x00, 0xFE, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x03,
  0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x03, 0x02, 0x02
};

const unsigned char yi[] U8X8_PROGMEM = { 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7F,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

const unsigned char er[] U8X8_PROGMEM = { 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

const unsigned char san[] U8X8_PROGMEM = { 
  0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x1F,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00
};

const unsigned char si[] U8X8_PROGMEM = { 
  0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
  0x12, 0x22, 0x12, 0x3C, 0x0A, 0x20, 0x06, 0x20, 0x02, 0x20, 0xFE, 0x3F, 0x02, 0x20, 0x00, 0x00
};

const unsigned char wu[] U8X8_PROGMEM = { 
  0x00, 0x00, 0xFE, 0x3F, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0xFC, 0x0F, 0x20, 0x08,
  0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, 0xFF, 0x7F, 0x00, 0x00
};

const unsigned char liu[] U8X8_PROGMEM = { 
  0x40, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00,
  0x20, 0x02, 0x20, 0x04, 0x10, 0x08, 0x10, 0x10, 0x08, 0x10, 0x04, 0x20, 0x02, 0x20, 0x00, 0x00
};

3.主程序从其他文件中调用字模数据,那么在其他文件下的定义数据时,注意事项:

const unsigned char xing[] = { 
  0x00, 0x00, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x80, 0x00, 0x88, 0x00,
  0xF8, 0x1F, 0x84, 0x00, 0x82, 0x00, 0xF8, 0x0F, 0x80, 0x00, 0x80, 0x00, 0xFE, 0x3F, 0x00, 0x00
};  
const unsigned char qi[] = { 
  0x44, 0x00, 0x44, 0x3E, 0xFE, 0x22, 0x44, 0x22, 0x44, 0x22, 0x7C, 0x3E, 0x44, 0x22, 0x44, 0x22,
  0x7C, 0x22, 0x44, 0x3E, 0x44, 0x22, 0xFF, 0x22, 0x20, 0x21, 0x44, 0x21, 0x82, 0x28, 0x41, 0x10
};  
const unsigned char Year1[] = { 
  0x04, 0x00, 0x04, 0x00, 0xFC, 0x07, 0x42, 0x00, 0x41, 0x00, 0xFC, 0x03,
  0x44, 0x00, 0x44, 0x00, 0xFF, 0x07, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00
};

const unsigned char yue[] = { 
  0x00, 0x00, 0xFC, 0x03, 0x04, 0x02, 0x04, 0x02, 0xFC, 0x03, 0x04, 0x02,
  0x04, 0x02, 0xFC, 0x03, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x81, 0x03
};
const unsigned char ri[] = { 
  0x00, 0x00, 0xFE, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x03,
  0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x03, 0x02, 0x02
};

4.取模后的数据具体使用的时候,该如何定义和定义在什么地方,根据自己的需求,自由选择,灵活应用,遵循以上规则。

5.对于定义使用什么修饰词const还是static,根据实际使用情况来定。

后记:

取模软件:PCtoLCD2002,

  • 汉字取模设置:阴码、逐行式、十六进制、逆向、C51格式、
  • 图片取模设置:
  • 例如:阴码和阳码(取反)显示效果

 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
更多>相关资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服