Yes, I knew I was asking for the slap in the face answer :)
I was expecting that I should be able to see something with all the bit twiddling I'm doing. Is there a chance that I don't have the volume / contrast controls setup right and that I just am not seeing it? When the display is being run only on 3.3V, how much current is it pulling? I also worry that I have a dead LCD and am just beating my head against an unpowered wall...
Thanks Zee,
Matt
Code:
void InitLCD(void)
{
long j;
CS = 1;
slow_wait_25ms (40);
SCK = 1;
MOSI = 0;
CS = 0;
LCDRESET = 0;
slow_wait_25ms (40);
LCDRESET = 1;
// ctl_timeout_wait(ctl_get_current_time() + 50);
slow_wait_25ms (40);
SendLcd(LCDCommand,DISCTL); // display control
SendLcd(LCDData,0x03); //00
SendLcd(LCDData,0x20); //20
SendLcd(LCDData,0x0C); //0A
SendLcd(LCDData,0x00); //None for other
SendLcd(LCDCommand,NOP); // Data Sheet recomends you send this from time to time
SendLcd(LCDCommand,COMSCN); //
SendLcd(LCDData,0x01); // Scan 1-80
SendLcd(LCDCommand,OSCON); //
SendLcd(LCDCommand,SLPOUT); // Sleep out command (must be done before DISPON)
// ctl_timeout_wait(ctl_get_current_time() + 100); // data sheet says to wait 100ms here
slow_wait_25ms (40);
SendLcd(LCDCommand,VOLCTR); // electronic volume, this is kinda contrast/brightness
SendLcd(LCDData,0xff);//ff // change this to get brighter or darker start point then use volup/down to adjust
SendLcd(LCDData,0x01);
SendLcd(LCDCommand,PWRCTR); // power ctrl
SendLcd(LCDData,0x0f); //everything on
//
//// ctl_timeout_wait(ctl_get_current_time() + 100); // data sheet says to wait 100ms here
slow_wait_25ms (40);
SendLcd(LCDCommand,DISINV);
// SendLcd(LCDCommand,TMPGRD); // Temp Gradient
// SendLcd(LCDData,0x01);
SendLcd(LCDCommand, DATCTL); // Data Control
SendLcd(LCDData, 0x00); // normal orientation; scan across cols, then rows
SendLcd(LCDData, 0x00); // RGB arrangement (RGB all rows/cols)
// WriteCommand(lctData, 0x04); // RGB arrangement (RGB row 1, BGR row 2)
SendLcd(LCDData, 0x01); // 8-color display
// WriteCommand(lctData, 0x02); // 16-color display
SendLcd(LCDData, 0x00); //
// LCD_Set_Resolution(LOW_RES);
SendLcd(LCDCommand,RGBSET8); // setup color lookup table
// Setup the color lookup table by choosing evenly spaced color values
// for a nice even spread. Blue only has 2 bits, so the spacing is wider
// but still spans 0x00 - 0x0f
// Bit organisation is RRRGGGBB
SendLcd(LCDCommand,RGBSET8);
SendLcd(LCDData,0x00); // RED
SendLcd(LCDData,0x02);
SendLcd(LCDData,0x04);
SendLcd(LCDData,0x06);
SendLcd(LCDData,0x08);
SendLcd(LCDData,0x0a);
SendLcd(LCDData,0x0c);
SendLcd(LCDData,0x0f);
SendLcd(LCDData,0x00); // GREEN
SendLcd(LCDData,0x02);
SendLcd(LCDData,0x04);
SendLcd(LCDData,0x06);
SendLcd(LCDData,0x08);
SendLcd(LCDData,0x0a);
SendLcd(LCDData,0x0c);
SendLcd(LCDData,0x0f);
SendLcd(LCDData,0x00); // BLUE
SendLcd(LCDData,0x04);
SendLcd(LCDData,0x09);
SendLcd(LCDData,0x0f);
SendLcd(LCDCommand,NOP); // Data Sheet recomends you send this from time to time
SendLcd(LCDCommand,PASET); // page start/end ram
SendLcd(LCDData,0x02); // for some reason starts at 2
SendLcd(LCDData,0x83);
SendLcd(LCDCommand,CASET); // column start/end ram
SendLcd(LCDData,0x00); // for some reason starts at 2
SendLcd(LCDData,0x83); // for some reason starts at 2
SendLcd(LCDCommand,RAMWR); // write some stuff (background)
for (j = 0; j < 18000; j++){
SendLcd(LCDData,0x1C); //28 = 0x1C = green
}
SendLcd(LCDCommand, DISON); // Turn Display ON
for (j = 0; j < 160; j++){ // this loop adjusts the contrast, change the number of iterations to get
SendLcd(LCDCommand, VOLUP); // desired contrast. This might be different for individual LCDs
slow_wait_25ms (4);
}
}