user27095: i just bought this lcd. I connected all pins as discripted on this datasheet (Page 8). However i noticed that there is no pin to control the contrast. I also didin't get the display to run yet.
Might that be a problem?
edit: here is the code...
#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()
{
}


user4143: I think your commands are a little wrong. Let's look at them:
LcdWriteCmd(0xAE); // LCD set display enabled

0xAE is 0b10101110. In the datasheet the matching command is 1010111# where # is display on (1) or off (0), so 0xAE is actually display disabled. Changing it to 0xAF instead, so bit 0 is 1, should enable the display.
LcdWriteCmd(0x21); // LCD set power COntrol

0x21 is 0b00100001. That command is 00100### where ### is the VLCD resistor ratio. That is being set to 2/8. ((# + 1) / 8).
LcdWriteCmd(0x14); // LCD bias mode 1:40

0x14 is 0b00010100, which is command 0001#### which sets the column address MSB. Quite why you're doing that I don't know, but that command has nothing to do with bias mode...
LcdWriteCmd(0xA2); // LCD basic commands

No, 0xA2 / 0xA3 sets the bias ratio set, which selects the bias from one of two groups of biases depending on the current duty. This is the default value.
So not only are you not configuring the screen correctly, but you aren't even then trying to put anything on the screen to see if it's working or not.
I suggest you work from the provided example code:

http://www.buydisplay.com/download/democode/ERC12864-655_DemoCode.txt

The "Initial" function sets the sequence of operations:
SET_ADC();
CLEAR_SHL();
CLEAR_BIAS();
Power_Control(0x07);
Regulor_Resistor_Select(0x06);
Set_Contrast_Control_Register(Contrast_level);
Initial_Dispay_Line(0x00);
DISPLAY_ON();

The main commands are defined at the top of the file:
#define DISPLAY_ON()           Write_Instruction(0xaf)   //  Display on
#define DISPLAY_OFF()          Write_Instruction(0xae)   //  Display off
#define SET_ADC()              Write_Instruction(0xa1)   //  Reverse disrect (SEG131-SEG0)
#define CLEAR_ADC()            Write_Instruction(0xa0)   //  Normal disrect (SEG0-SEG131)
#define REVERSE_DISPLAY_ON()   Write_Instruction(0xa7)   //  Reverse display : 0 illuminated
#define REVERSE_DISPLAY_OFF()  Write_Instruction(0xa6)   //  Normal display : 1 illuminated
#define ENTIRE_DISPLAY_ON()    Write_Instruction(0xa5)   //  Entire dislay   Force whole LCD point
#define ENTIRE_DISPLAY_OFF()   Write_Instruction(0xa4)   //  Normal display
#define SET_BIAS()             Write_Instruction(0xa3)   //  bias 1   1/7 bais
#define CLEAR_BIAS()           Write_Instruction(0xa2)   //  bias 0   1/9 bais
#define RESET()                Write_Instruction(0xe2)  //   system reset
#define SET_SHL()              Write_Instruction(0xc8)   // SHL 1,COM63-COM0
#define CLEAR_SHL()            Write_Instruction(0xc0)   // SHL 0,COM0-COM63

The more complex ones are simple enough - just ORing the provided parameter with the base command. For example Power_Control() just does:
Write_Instruction((0x28|vol));

I am sure you can find (and decipher) the rest of the commands to initialize the screen properly.

27095: <p>i just bought <a href="http://www.buydisplay.com/default/blue-2-8-inch-128x64-display-serial-lcd-module-spi-with-touch-panel" rel="nofollow">this lcd</a>. I connected all pins as discripted on <a href="http://www.buydisplay.com/download/manual/ERC12864-655_Series_Datasheet.pdf" rel="nofollow">this datasheet</a> (Page 8). However i noticed that there is no pin to control the contrast. I also didin't get the display to run yet.</p>

<p>Might that be a problem?</p>

<p>edit: here is the code...</p>

<pre><code>#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()
{
}
</code></pre>
 4143: <p>I think your commands are a little wrong. Let's look at them:</p>

<pre><code>LcdWriteCmd(0xAE); // LCD set display enabled
</code></pre>

<p>0xAE is 0b10101110. In the datasheet the matching command is <code>1010111#</code> where <code>#</code> is display on (1) or off (0), so 0xAE is actually display <em>disabled</em>. Changing it to 0xAF instead, so bit 0 is 1, should enable the display.</p>

<pre><code>LcdWriteCmd(0x21); // LCD set power COntrol
</code></pre>

<p>0x21 is 0b00100001. That command is <code>00100###</code> where <code>###</code> is the VLCD resistor ratio. That is being set to 2/8. ((<code>#</code> + 1) / 8).</p>

<pre><code>LcdWriteCmd(0x14); // LCD bias mode 1:40
</code></pre>

<p>0x14 is 0b00010100, which is command <code>0001####</code> which sets the column address MSB. Quite why you're doing that I don't know, but that command has nothing to do with bias mode...</p>

<pre><code>LcdWriteCmd(0xA2); // LCD basic commands
</code></pre>

<p>No, 0xA2 / 0xA3 sets the bias ratio set, which selects the bias from one of two groups of biases depending on the current duty. This is the default value.</p>

<p>So not only are you not configuring the screen correctly, but you aren't even then trying to put anything on the screen to see if it's working or not.</p>

<p>I suggest you work from the provided example code:</p>

<ul>
<li><a href="http://www.buydisplay.com/download/democode/ERC12864-655_DemoCode.txt" rel="nofollow">http://www.buydisplay.com/download/democode/ERC12864-655_DemoCode.txt</a></li>
</ul>

<p>The "Initial" function sets the sequence of operations:</p>

<pre><code>SET_ADC();
CLEAR_SHL();
CLEAR_BIAS();
Power_Control(0x07);
Regulor_Resistor_Select(0x06);
Set_Contrast_Control_Register(Contrast_level);
Initial_Dispay_Line(0x00);
DISPLAY_ON();
</code></pre>

<p>The main commands are defined at the top of the file:</p>

<pre><code>#define DISPLAY_ON()           Write_Instruction(0xaf)   //  Display on
#define DISPLAY_OFF()          Write_Instruction(0xae)   //  Display off
#define SET_ADC()              Write_Instruction(0xa1)   //  Reverse disrect (SEG131-SEG0)
#define CLEAR_ADC()            Write_Instruction(0xa0)   //  Normal disrect (SEG0-SEG131)
#define REVERSE_DISPLAY_ON()   Write_Instruction(0xa7)   //  Reverse display : 0 illuminated
#define REVERSE_DISPLAY_OFF()  Write_Instruction(0xa6)   //  Normal display : 1 illuminated
#define ENTIRE_DISPLAY_ON()    Write_Instruction(0xa5)   //  Entire dislay   Force whole LCD point
#define ENTIRE_DISPLAY_OFF()   Write_Instruction(0xa4)   //  Normal display
#define SET_BIAS()             Write_Instruction(0xa3)   //  bias 1   1/7 bais
#define CLEAR_BIAS()           Write_Instruction(0xa2)   //  bias 0   1/9 bais
#define RESET()                Write_Instruction(0xe2)  //   system reset
#define SET_SHL()              Write_Instruction(0xc8)   // SHL 1,COM63-COM0
#define CLEAR_SHL()            Write_Instruction(0xc0)   // SHL 0,COM0-COM63
</code></pre>

<p>The more complex ones are simple enough - just ORing the provided parameter with the base command. For example <code>Power_Control()</code> just does:</p>

<pre><code>Write_Instruction((0x28|vol));
</code></pre>

<p>I am sure you can find (and decipher) the rest of the commands to initialize the screen properly.</p>
