1

I just bought an LCD. I connected everything as explained in this sheet.

This is the code I am using:

#define RST 3
#define CE 2
#define DC 4
#define DIN 6
#define CLK 5

void LcdWriteCmd(byte cmd) {
  digitalWrite(DC, HIGH); //DC pin is low for commands
  digitalWrite(CE, HIGH);
  shiftOut(DIN, CLK, MSBFIRST, cmd); //transmit serial data
  digitalWrite(CE, LOW);
}

void setup() {
  pinMode(RST, OUTPUT);
  pinMode(CE, OUTPUT);
  pinMode(DC, OUTPUT);
  pinMode(DIN, OUTPUT);
  pinMode(CLK, OUTPUT);
  digitalWrite(RST, LOW);
  digitalWrite(RST, HIGH); 
  LcdWriteCmd(0xAE); // LCD set display enabled
  LcdWriteCmd(0x21); // LCD set power COntrol
  LcdWriteCmd(0x14); // LCD bias mode 1:40
  LcdWriteCmd(0xA2); // LCD basic commands
  LcdWriteCmd(0xA9); // LCD all segments on
}

void loop() {
}

The commands I used are in the command table of this sheet. (page 12) It is supposed to turn all pixels on now. However nothing happens. All pixels are staying off.

Can you see a problem?

  • Can you put a link or datasheet of your specificaties LCD? There are a lot of LCD's on the market – Paul Dec 6 '16 at 6:52
  • On most devices CE is active low. In LcdWriteCmd you set it high, send the command and then set it low, try swapping that to low, send command, high. Also when you set reset low then high maybe add a short pause in there. A millisecond or less would be fine, just something to add a tiny delay. And maybe double check that your LCD has an active low reset not active high, if it's being held in reset then nothing will show up, active low is more common but isn't guaranteed. – Andrew Dec 6 '16 at 10:41
1

I am not so sure the command that you used to turn all pixels on is right. It might say it in the document but you should try to manually turn a couple of pixels on yourself. check the link bellow if you need more assistance with LCDs.

Also be sure that you connected some power and a potentiometer to the contrast pin and/or backlight of the LCD.

https://www.youtube.com/watch?v=dZZynJLmTn8

  • 1
    thank you. The contrast could be a problem. I always saw that the contrast level is controlled by a pin called VEE. However i didn't find a pin that has that name and there is also no pin that could be for contrast (buydisplay.com/download/ic/UC1701.pdf , page 6). I that a problem? – betion Oct 6 '16 at 19:00
  • Your LCD seems a little weird in the sense that it doesn't feature any contrast pins. – Dat Ha Oct 6 '16 at 19:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.