마지막으로 알아볼 녀석은 LCD1602 모듈입니다.




우선 datasheet를 먼저 보려고.. 했으나... ㅎㄷㄷ


http://www.elecrow.com/download/LCD1602.pdf



PIN map을 확인하여 arduino에 연결을 적절히(?) 해주세요. Ground를 특히 주의하셔야 합니다.


다행히 LCD library가 Arduino에서 제공되고 있어, Datasheet의 Initialization Sequence 정도 참고로 보시면 될듯합니다.





가난한 S/W 쟁이라 아무생각 없이 우선 cable들만 연결해서 동작이 되는지 확인해 보았습니다.



하지만 접지에 문제가 있는지 제대로 동작하지 않는 ㅠ.ㅠ

접지가 제대로 되지 않아 글자도 깨져 출력 되어 전원 인가된 상태만 확인하였습니다.

아래 사진에 하얀색으로 빵처럼 납작하게 생긴 판은 일명 빵판(bread-board)입니다.




결국 H/W 랩실에 들어가서 정상적으로 PIN head로 납땜을 해주었습니다.


S*-H사에서 갈고 닦은 납땜 실력으로 겨우 겨우 ^^:








/*

  LiquidCrystal Library - Hello World


 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.


 This sketch prints "Hello World!" to the LCD

 and shows the time.


  The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * LCD VSS pin to ground

 * LCD VCC pin to 5V

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)


 Library originally added 18 Apr 2008

 by David A. Mellis

 library modified 5 Jul 2009

 by Limor Fried (http://www.ladyada.net)

 example added 9 Jul 2009

 by Tom Igoe

 modified 22 Nov 2010

 by Tom Igoe


 This example code is in the public domain.


 http://www.arduino.cc/en/Tutorial/LiquidCrystal

 */


// include the library code:

#include <LiquidCrystal.h>


// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(16, 2);

  // Print a message to the LCD.

  lcd.print("hello, world!");

}


void loop() {

  // set the cursor to column 0, line 1

  // (note: line 1 is the second row, since counting begins with 0):

  lcd.setCursor(0, 1);

  // print the number of seconds since reset:

  lcd.print(millis() / 1000);

}


References :

https://www.arduino.cc/en/Tutorial/HelloWorld?from=Tutorial.LiquidCrystal

http://cafe.naver.com/mpucafe/2863

https://learn.adafruit.com/character-lcds/wiring-a-character-lcd

http://blog.naver.com/q19891204/220605172716

반응형

+ Recent posts