如何将 LCD 编程为仅使用自定义字体?

How do I program an LCD to only use custom fonts?

我正在做一个只需要使用自定义字体的项目。我已经将所有拉丁字母定义为字节数组,这样我就可以简单地将数组值复制到要写入的变量中。下面是我的代码片段。

void menuInit() {
  byte customChar1[8];
  byte customChar2[8];
  byte customChar3[8];
  byte customChar4[8];
  byte customChar5[8];
  byte customChar6[8];
  byte customChar7[8];
  byte customChar8[8];

  for (int i = 0; i <= 7; i++) {
    customChar1[i] = H[i];
    customChar2[i] = E[i];
    customChar3[i] = A[i];
    customChar4[i] = T[i];
  }

  lcd.createChar(0, customChar1);
  lcd.createChar(1, customChar2);
  lcd.createChar(2, customChar3);
  lcd.createChar(3, customChar4);

  lcd.setCursor(0, 0);

  lcd.write(byte(0));
  lcd.write(byte(1));
  lcd.write(byte(2));
  lcd.write(byte(3));

  for (int i = 0; i <= 7; i++) {
    customChar1[i] = C[i];
    customChar2[i] = O[i];
    customChar3[i] = O[i];
    customChar4[i] = L[i];
  }

  lcd.createChar(0, customChar1);
  lcd.createChar(1, customChar2);
  lcd.createChar(2, customChar3);
  lcd.createChar(3, customChar4);

  lcd.setCursor(0, 1);

  lcd.write(byte(0));
  lcd.write(byte(1));
  lcd.write(byte(2));
  lcd.write(byte(3));

Arduino LCD 文档说我需要在 lcd.write() 中写入 byte(int) 才能打印创建的自定义字符。但是,如果我这样做,我的 LCD 上会显示两行 "COOL"。这可能是因为第一行和第二行都引用了同一个地址。有什么方法可以将字节值复制到其他地方并让它保持原样吗?

大多数字符模式 LCD 在 ROM 中带有标准字体,并且能够制作一些自定义字符(通常为 8 个)。参考了你的datasheet,不过十年来我见过的任何一款LCD都没有你想要的。

图形 LCD 不同,因为您可以"draw"随心所欲。