1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ArduinoでAitendo ATD1602CPを使う

Last updated at Posted at 2020-03-14

ATD1602CPとは

aitendoで取り扱われている「I2CキャラクタLCDモジュール(16x2)」です。(販売ページ)
このLCDモジュールはコントローラICに「SPLC792A(ST7032互換)」を搭載しており、I2C通信で制御することができます。

特徴として、ピン間隔が2.54mmピッチのため変換基板等を必要としません。

回路図

ATD1602CP.jpg

LCDに対して上図の通り配線します。
SHL及びDIRCはLCD表示向きを決める端子で、VCC GNDのどちらかに接続します。
組み合わせによりLCD表示を左右・上下逆に変更することができます。
なお、図の結線では、ピンを手前にした場合に正しく表示される向きとなります。

プログラム

LCD_ST7032ライブラリの導入

ST7032用ライブラリにはいくつかの種類がありますが、ここでは「LCD_ST7032」を使用しました。
Arduino IDEのライブラリマネージャにて「LCD_7032」をインストールしておきます。

プログラム

以下の通りとしました。(サンプル参照)

# include <LCD_ST7032.h>

LCD_ST7032 lcd;

void setup() {
  lcd.begin();
  lcd.setcontrast(24); //コントラスト値を指定する(0-63) 推奨値:25@5V or 50@3.3V
}

void loop() {
  static int counter = 0;
  
  // 1行目を表示
  lcd.setCursor(0, 0);  //1行目 0文字目
  lcd.print("Hello World");

  // 2行目を表示
  lcd.setCursor(1, 0);
  lcd.print(counter/10, DEC);
  lcd.write('.');
  lcd.print(counter%10, DEC);
  lcd.write(' ');
  delay(500);
  counter++;
}

動作例

2.PNG

動作例では互換Arduino Nanoへ接続しています。
正常に動作した場合、1行目に「Hello World」、2行目に0.5秒ごとに0.1ずつカウントアップする数字が表示されます。

トラブルシューティング

表示が真っ白のまま

RESETピンが未接続の場合、なにも表示されません。
VCCへ接続した後、Arduinoのリセットボタンを押してください。

参考

データシート(http://aitendo3.sakura.ne.jp/aitendo_data/product_img/lcd/fstn/16X2-SPLC792-I2C/SPLC792A_V03_HAOTIAN.pdf)
商品ページ(https://www.aitendo.com/product/17458)

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?