2012年4月20日金曜日

ディスプレイの設定

ディスプレイには秋月電子のものを使用した。
ディスプレイ        Arduino
LCD-DB7     14pin    D4
LCD-DB6     13pin    D5  
LCD-DB5     12pin    D6  
LCD-DB4     11pin    D7
LCD-E         6pin    D11
LCD-R/W      5pin
LCD-RS        4pin    D12

LCD-Vo         3pin    potentiometerの中点で端点はGNDと+5v

                    2pin            +5V            
                    1pin            GND            
                  16pin             GND          
                  15pin            +4.2V       抵抗100 ohmを経由する

Sketch


// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
//LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.home();
  lcd.print("Hello, World!");
  lcd.setCursor(0,1);
  lcd.print("JA1NHL");
  lcd.setCursor(10,1);
}

void loop() {
  // Turn off the display:
  lcd.noDisplay();
  delay(500);
   // Turn on the display:
  lcd.display();
  delay(500);
}

/*
  LiquidCrystal Library - display() and noDisplay()

 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 uses the
 display() and noDisplay() functions to turn on and off
 the display.

 The circuit:
 * LCD RS pin(pin 4) to digital pin 12
 * LCD Enable pin(pin 6) to digital pin 11
 * LCD DB4 pin(pin 11)to digital pin 7
 * LCD DB5 pin(pin 12) to digital pin 6
 * LCD DB6 pin(pin 13) to digital pin 5
 * LCD DB7 pin(pin 14) to digital pin 4
 * LCD R/W pin(pin 5) to ground
 * 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
 */



完成すると Hello, World!
JA1NHL 
と表示され、表示が点滅する。

0 件のコメント:

コメントを投稿