极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 17228|回复: 6

请教lcd12864RSPI 如何给LCD Smartie 使用?

[复制链接]
发表于 2014-3-27 18:02:52 | 显示全部楼层 |阅读模式
本帖最后由 sky929 于 2014-3-31 14:42 编辑

小弟是新手,参考国外网站


http://milesburton.com/LCD_Smartie_Powered_By_Arduino_Liquid_Crystal_library
但位置不对,和有乱码
希望大大可赐教
回复

使用道具 举报

发表于 2014-3-28 13:06:57 | 显示全部楼层
你买的是什么型号的?国产的12864可能改过了,特别是带汉字字库的。
也许可以试试这个
http://www.geek-workshop.com/thread-8752-1-1.html
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-3-28 13:37:45 | 显示全部楼层

谢谢大大回覆,先试试

本帖最后由 sky929 于 2014-3-28 16:19 编辑

谢谢大大回覆,先试试
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-3-28 16:17:05 | 显示全部楼层
本帖最后由 sky929 于 2014-3-31 14:43 编辑
savagego 发表于 2014-3-28 13:06
你买的是什么型号的?国产的12864可能改过了,特别是带汉字字库的。
也许可以试试这个
http://www.geek-w ...


我試用了这个库,ST7920串口显示,但只出数字

#include "LCD12864RSPI.h"
#define AR_SIZE( a ) sizeof( a ) / sizeof( a[0] )

LCD12864RSPI LCDA(A0,A1,A2);

///LCD12864RSPI(int _latchPin,int _dataPin,int _clockPin):
//RS->A0,R/W->A1,E->A2

//LCD Smartie matrix.dll 4x16 ;

void setup() {
  Serial.begin(9600);
}

byte serial_getch(){
  
  int incoming;  
  while (Serial.available()==0){}
  incoming = Serial.read();
  return (byte) (incoming &0xff);
}
void loop(){
  byte rxbyte;
  byte temp;
  int row = 0;  
  rxbyte = serial_getch();
  if (rxbyte == 254) //Matrix Orbital uses 254 prefix for commands
  {
    switch (serial_getch())
    {
    case 66: //backlight on (at previously set brightness)
      // not implemented                                
      break;
    case 70: //backlight off
      // not implemented                                
      break;
      
    case 71:  //set cursor position
      row = (serial_getch() - 1);  //get column byte
      switch (serial_getch())  //get row byte
      {
      case 1:
        row = 0;//row1
        break;
      case 2:
        row = 1;//row2
        break;
      case 3:
        row = 2;//row3
        break;
      case 4:
        row = 3;//row4
        break;
      default:
        break;
      }
      LCDA.setCursor(row,0);
      break;
      case 72:  //cursor home (reset display position)
      break;
    case 74:  //show underline cursor
      break;
    case 75:  //underline cursor off
    case 84:  //block cursor off
      break;
    case 76:  //move cursor left
      break;
    case 77:  //move cursor right
      break;
    case 78:  //define custom char
      break;
    case 83:  //show blinking block cursor
      break;
    case 86:  //GPO OFF
      //implement later
      break;
    case 87:  //GPO ON
      break;
    case 88:  //clear display, cursor home
      LCDA.clear();
      break;
    case 152: //set and remember (doesn't save value, though)
    case 153: //set backlight brightness
      //not implemented
      break;

      //these commands ignored (no parameters)
    case 35: //read serial number
    case 36: //read version number
    case 55: //read module type
    case 59: //exit flow-control mode
    case 65: //auto transmit keypresses
    case 96: //auto-repeat mode off (keypad)
    case 67: //auto line-wrap on
    case 68: //auto line-wrap off
    case 81: //auto scroll on
    case 82: //auto scroll off
    case 104: //init horiz bar graph
    case 109: //init med size digits
    case 115: //init narrow vert bar graph
    case 118: //init wide vert bar graph
      break;
    default:
      //all other commands ignored and parameter byte discarded
      temp = serial_getch();  //dump the command code
      break;
    }
    return;
  }

  LCDA.print(rxbyte);  //otherwise a plain char so we print it to lcd
  return;

}

在LCD 中出现的是全DEC 数字例如串口输出”A” LCD 是65 请问如何解决
谢谢
回复 支持 反对

使用道具 举报

发表于 2014-3-31 13:31:05 | 显示全部楼层
Serial.print("A");
LCDA.print("A");
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-3-31 14:39:01 | 显示全部楼层
savagego 发表于 2014-3-31 13:31
Serial.print("A");
LCDA.print("A");

原来最尾是
LCDA.print(char(rxbyte));
谢谢大大回覆
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-4-1 20:05:43 | 显示全部楼层
请问可不可以用u8glib做同一結果?可教教小弟吗?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-5 17:38 , Processed in 0.055437 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表