2016年6月22日 星期三

[Arduino] LCD5110


簡介


這是一個Nokia 5110用的液晶螢幕,2手良品 。













































店家的說明

http://www.ltc.com.tw/product_info.php/products_id/60701

Nokia5110液晶螢幕是諾基亞手機的二手拆機螢幕,本店出售的液晶螢幕皆經供應商嚴格挑選與測試,請安心選購。
PCB提供上下兩排接線埠,排列如下:
1. RST:重定
2. CE:片選
3. DC:資料/指令選擇
4. DIN:串列資料線
5. CLK:串列時鐘線
6. VCC:電源輸入(DC3.3V 或 DC5V均可,經過實驗驗證,沒有問題)
7. BL:背光控制端
8. GND:地線
介面為串列SPI介面


規格簡述如下

他的解析度為 84x48 pixel 單色LCD,大小約1.5" ,他和文字型LCD不同的是

他可以顯示圖片(當然也就只有單色)。

他的LED背光,是可以用類別的輸出或是PWM來調整它的亮度,即使沒有背光,也不會

影響字的顯示。



接線方法


接線方法

5110 LCD                 Arduino

LCD                          3.3V

SCLK                        D3

DIN<MOSI>           D4

D/C                         D5

RST                           D6

SCE                         D7

GDN                       GND

VCC                       5V                  



載入函式庫


下載Lib  (.ZIP) 並加入

https://github.com/carlosefr/pcd8544

































呼叫範例












































Code


/*
 * PCD8544 - Interface with Philips PCD8544 (or compatible) LCDs.
 *
 * Copyright (c) 2010 Carlos Rodrigues <cefrodrigues@gmail.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

/*
 * To use this sketch, connect the eight pins from your LCD like thus:
 *
 * Pin 1 -> +3.3V (rightmost, when facing the display head-on)
 * Pin 2 -> Arduino digital pin 3
 * Pin 3 -> Arduino digital pin 4
 * Pin 4 -> Arduino digital pin 5
 * Pin 5 -> Arduino digital pin 7
 * Pin 6 -> Ground
 * Pin 7 -> 10uF capacitor -> Ground
 * Pin 8 -> Arduino digital pin 6
 *
 * Since these LCDs are +3.3V devices, you have to add extra components to
 * connect it to the digital pins of the Arduino (not necessary if you are
 * using a 3.3V variant of the Arduino, such as Sparkfun's Arduino Pro).
 */


#include <PCD8544.h>


// A custom glyph (a smiley)...
static const byte glyph[] = { B00010000, B00110100, B00110000, B00110100, B00010000 };


static PCD8544 lcd;


void setup() {
  // PCD8544-compatible displays may have a different resolution...
  lcd.begin(84, 48);

  // Add the smiley to position "0" of the ASCII table...
  lcd.createChar(0, glyph);
}


void loop() {
  // Just to show the program is alive...
  static int counter = 0;

  // Write a piece of text on the first line...
  lcd.setCursor(0, 0);
  lcd.print("Hello,blogger");

  // Write the counter on the second line...
  lcd.setCursor(0, 1);
  lcd.print(counter, DEC);
  lcd.write(' ');
  lcd.write(0);  // write the smiley

  // Use a potentiometer to set the LCD contrast...
  // short level = map(analogRead(A0), 0, 1023, 0, 127);
  // lcd.setContrast(level);

  delay(200);
  counter++;
}


/* EOF - HelloWorld.ino */




執行結果











































參考資料



http://www.ltc.com.tw/product_info.php/products_id/60701

http://qmaw.pixnet.net/blog/post/383290205-%5Barduino%5Dnokia-3310-5110-84*48-pcd8564-lcd-part-1-1

沒有留言:

張貼留言