示例#1
0
  /**
   * LCDディスプレイの表示
   *
   * @param mcu
   * @param rs
   * @param ee
   * @param d0
   * @param d1
   * @param d2
   * @param d3
   * @param type LCD機種
   */
  public TextLCD(Mcu mcu, int rs, int ee, int d0, int d1, int d2, int d3, LCDType type) {
    _type = type;
    _mcu = mcu;
    try {
      _rs = new DigitalOut(_mcu, rs);
      _e = new DigitalOut(_mcu, ee);
      _d = new BusOut(_mcu, d0, d1, d2, d3);

      _e.write(1);
      _rs.write(0);

      Thread.sleep(15);

      for (int i = 0; i < 3; i++) {
        writeByte(0x3);
        Thread.sleep(2);
      }
      writeByte(0x2);
      Thread.sleep(1);

      writeCommand(0x28);
      writeCommand(0x0C);
      writeCommand(0x6);
      cls();

    } catch (InterruptedException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    } catch (MbedJsException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
示例#2
0
 /** 画面をクリアする */
 public void cls() {
   writeCommand(0x01);
   try {
     Thread.sleep(1);
   } catch (InterruptedException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   locate(0, 0);
 }
示例#3
0
 /**
  * 1バイト書き込み
  *
  * @param value
  */
 void writeByte(int value) {
   try {
     _d.write(value >> 4);
     Thread.sleep(1);
     _e.write(0);
     Thread.sleep(1);
     _e.write(1);
     _d.write(value >> 0);
     Thread.sleep(1);
     _e.write(0);
     Thread.sleep(1);
     _e.write(1);
   } catch (MbedJsException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (InterruptedException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }