ASCII 7x5 side-feeding characters for led modules

心不动则不痛 提交于 2019-12-11 08:11:57

问题


I am looking at the code for the font file here: http://www.openobject.org/opensourceurbanism/Bike_POV_Beta_4

The code starts like this:

const byte font[][5] = {
  {0x00,0x00,0x00,0x00,0x00},   //   0x20 32
  {0x00,0x00,0x6f,0x00,0x00},   // ! 0x21 33
  {0x00,0x07,0x00,0x07,0x00},   // " 0x22 34
  {0x14,0x7f,0x14,0x7f,0x14},   // # 0x23 35
  {0x00,0x07,0x04,0x1e,0x00},   // $ 0x24 36
  {0x23,0x13,0x08,0x64,0x62},   // % 0x25 37
  {0x36,0x49,0x56,0x20,0x50},   // & 0x26 38
  {0x00,0x00,0x07,0x00,0x00},   // ' 0x27 39
  {0x00,0x1c,0x22,0x41,0x00},   // ( 0x28 40
  {0x00,0x41,0x22,0x1c,0x00},   // ) 0x29 41
  {0x14,0x08,0x3e,0x08,0x14},   // * 0x2a 42
  {0x08,0x08,0x3e,0x08,0x08},   // + 0x2b 43

and so on...

I am very confused as to how this code works - can someone explain it to me please?

Thanks,

Majd


回答1:


Each array of 5 bytes = 40 bits which map to the 7x5 = 35 pixels in the character grid (there are 5 unused bits presumably).

When you want to display a character you copy the corresponding 5 byte bitmap for that character to the appropriate memory location. E.g. to display the character X you would copy the data from font['X'].



来源:https://stackoverflow.com/questions/2912961/ascii-7x5-side-feeding-characters-for-led-modules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!