protected void SendCommand(int comm, BacklightControl backlight = BacklightControl.LCD_BACKLIGHT) { byte buf; buf = (byte)(comm & 0xF0); buf |= (byte)((byte)ControlBits.En | (byte)backlight); WriteByte(buf); Thread.Sleep(2); WriteByte((byte)backlight); buf = (byte)((comm & 0x0F) << 4); buf |= (byte)((byte)ControlBits.En | (byte)backlight); WriteByte(buf); Thread.Sleep(2); WriteByte((byte)backlight); }
protected void SendData(int data, BacklightControl backlight = BacklightControl.LCD_BACKLIGHT) { byte buf; buf = (byte)(data & 0xF0); buf |= (byte)ControlBits.En | (byte)BacklightControl.LCD_BACKLIGHT | (byte)ControlBits.Rs; buf |= 0x08; WriteByte(buf); Thread.Sleep(2); WriteByte((byte)backlight); buf = (byte)((data & 0x0F) << 4); buf |= (byte)ControlBits.En | (byte)BacklightControl.LCD_BACKLIGHT | (byte)ControlBits.Rs; WriteByte(buf); Thread.Sleep(2); WriteByte((byte)backlight); }