Author Topic: NHD 2.7 Screen Image Streaking  (Read 8866 times)

cherry8wild

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
NHD 2.7 Screen Image Streaking
« on: July 17, 2014, 12:20:33 PM »
Hello,

I am currently working on a project using a Newhaven 2.7" OLED Graphic display. I have a problem with the screen Images turning out poorly. when some pixels in a column are on, the whole column glows (at different intensities based on the number of pixels that are on). In all of the photos, the screen is cleared, and written over as all pixels OFF, before any ON pixels are written.

Any thoughts?


Info:
Display - NHD‐2.7‐12864UCY3
Interface - SPI

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #1 on: July 18, 2014, 11:01:28 AM »
Is it probably something to do with your initialization.  Try using these values:

Code: [Select]
comm_out(0xAE);
 
  comm_out(0xB3);
  comm_out(0x01);
  comm_out(0x90);
 
  comm_out(0xA8);
  comm_out(0x3F);
 
  comm_out(0xA2);
  comm_out(0x4C);
 
  comm_out(0xA1);
  comm_out(0x00);
 
  comm_out(0xAD);
  comm_out(0x00);
 
  comm_out(0xA0);
  comm_out(0x50);
 
  comm_out(0x84);
 
  comm_out(0xB8);
  comm_out(0x01);
  comm_out(0x11);
  comm_out(0x22);
  comm_out(0x32);
  comm_out(0x43);
  comm_out(0x54);
  comm_out(0x65);
  comm_out(0x76);
 
  comm_out(0x81);
  comm_out(0x7F);
 
  comm_out(0xB2);
  comm_out(0x51);
 
  comm_out(0xB1);
  comm_out(0x55);
 
  comm_out(0xBC);
  comm_out(0x10);
 
  comm_out(0xB4);
  comm_out(0x02);
  comm_out(0xB0);
  comm_out(0x28);
 
  comm_out(0xBE);
  comm_out(0x1C);
 
  comm_out(0xBF);
  comm_out(0x0C);
 
  comm_out(0xA4);
 
  comm_out(0xAF);

cherry8wild

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #2 on: July 21, 2014, 10:30:08 AM »
Alright, Thanks. I'll try those values out.

cherry8wild

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #3 on: July 21, 2014, 11:43:05 AM »
OK,

The values I was using for the Initialization were slightly different, but the same streaking occurs with the new values as well. Here is the initialization function I am using, if there is still anything wrong.

Code: [Select]
void OLED_12864_Init_test()
{
    TRIS_RS =   0;
    TRIS_SCLK = 0;
    TRIS_CS =   0;
    TRIS_SDIN = 0;

    SSPCON1bits.SSPEN = 0;
    SSPSTATbits.SMP = 1; // SPI Master Mode
    SSPSTATbits.CKE = 1;
    SSPCON1bits.SSPM3 = 0;
    SSPCON1bits.SSPM2 = 0;
    SSPCON1bits.SSPM1 = 0;
    SSPCON1bits.SSPM0 = 0;

    SSPCON1bits.SSPEN = 1;

    LAT_CS = 1;

    LAT_RS = 0;
    mDelay(40);
    LAT_RS = 1;

    SPI_Write1(0xAE); // Set display OFF

    SPI_Write1(0xB3); // Set Display Clock
    SPI_Write1(0x01);
    SPI_Write1(0x90);

    SPI_Write1(0xA8); // Set Multiplex Ratio
    SPI_Write1(0x3F);

    SPI_Write1(0xA2); // Set Display Offset
    SPI_Write1(0x4C);

    SPI_Write1(0xA1); // Start Line
    SPI_Write1(0x00);

    SPI_Write1(0xAD); // Set Master Configuration
    SPI_Write1(0x00);

    SPI_Write1(0xA0); // Set Remap Format
    SPI_Write1(0x50);

    SPI_Write1(0x84); // Set Current Range (1/4)

    SPI_Write1(0xB8); // Set Greyscale Table
    SPI_Write1(0x01);
    SPI_Write1(0x11);
    SPI_Write1(0x22);
    SPI_Write1(0x32);
    SPI_Write1(0x43);
    SPI_Write1(0x54);
    SPI_Write1(0x65);
    SPI_Write1(0x76);

    SPI_Write1(0x81); // Set Contranst Current
    SPI_Write1(0x7F);

    SPI_Write1(0xB2); // Set Row Period (Frame Frequency)
    SPI_Write1(0x51);

    SPI_Write1(0xB1); // Set Phase Length
    SPI_Write1(0x55);

    SPI_Write1(0xBC); // Set Precharge Voltage
    SPI_Write1(0x10);

    SPI_Write1(0xB4); // Set Precharge Compensation
    SPI_Write1(0x02);

    SPI_Write1(0xB0); // Set Precharge Enable
    SPI_Write1(0x28);

    SPI_Write1(0xBE); // Set V_com_H Voltage level
    SPI_Write1(0x1C);

    SPI_Write1(0xBF); // Set Segment Low voltage
    SPI_Write1(0x0C);

    SPI_Write1(0xA4); //Set Display Mode Normal

    SPI_Write1(0xAF); // Set Display On
Also, the wiring diagram and the hardware setup. I have a very basic setup, pretty much taken straight from the NHD data sheet. Any suggestions appreciated! Screen is very clear and easy to read, but the streaking lines are not acceptable for my application.
« Last Edit: July 21, 2014, 11:57:54 AM by cherry8wild »

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #4 on: July 21, 2014, 11:53:17 AM »
You are calling command 0xBE twice in your initialization.  The second one should be 0xBF.

cherry8wild

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #5 on: July 21, 2014, 11:57:24 AM »
Good catch, you are correct. Unfortunately, no change in the display. :/

(Updated the code for future users)

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #6 on: July 21, 2014, 11:59:07 AM »
What voltage are you supplying the display with?  Do you have another you can try?

cherry8wild

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #7 on: July 21, 2014, 12:03:23 PM »
Measured, the display is getting 3.295V, and unfortunately we do not have another display to try.

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #8 on: July 21, 2014, 04:35:18 PM »
To my knowledge, the only cause of this would be your initialization.  The values I have given you have been confirm to work great, with no streaking (by myself and our customers).  If you are certain you are initializing the display correctly, you may either email nhtech@newhavendisplay.com to set up an RMA and return the display to us for analysis, or you may purchase another sample of the display and try it with your micro.

cherry8wild

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #9 on: July 22, 2014, 10:03:43 AM »
We are going to order another display to test, but for now since it works other than the streaking, we are going to continue using it for development. Have you seen this behavior before?

We analyzed the signals going to the display yesterday using a logic analyzer and the display is getting the correct initialization.

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #10 on: July 22, 2014, 10:47:57 AM »
The only time I have seen it before was because of the initialization.  Keep us posted on how the second display works, but in the mean time you can try different values for various commands such as commands 0x81, 0xB4, 0xBC, 0xBE, and 0xBF, just to see if you see any visual changes on the display.
For details on these commands, please refer to the SSD1325 datasheet, here:
http://www.newhavendisplay.com/app_notes/SSD1325.pdf

SLTom992

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #11 on: July 29, 2014, 12:42:25 PM »
I know that if you initialize the controller with a Display Offset you can get smearing though I don't know why. Make sure that your offet is zero.

cherry8wild

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #12 on: August 05, 2014, 06:24:56 PM »
Hello again,

Here is an update on what I have tried and the results of those attempts.

1. Changing Display

I got another identical display, but it did the same thing.

2. Changing the controller

I also have used an Arduino Mega 2560 to run the display. This was running completely different code than the Microchip controller, but the same initialization sequence. Same results.

3. Different values for Initalization.

I have programmed the displays to cycle through various initialization parameters, specifically the contrast current, contrast current range, precharge compensation, precharge voltage, and the VcomH voltage. I was able to observe the changes in the display but none of them ever removed the lines completely.

The best Screen image has been when I use :

Current Range: 0x86
Contrast Current: 0x3F
Precharge Compensation: 0x02
Precharge Voltage: 0x10

this is seen in the image "Menu Navigation". However, the same settings with a display screen which is not as full yields the same streaking lines. The displays also look best when the majority of the screen is on. When there are only a few pixels on, it becomes worse.

4. As for the Display offset, I actually need to use that functionality of this display, but even when it is zero, the streaks occur.


Any more thoughts?

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #13 on: August 07, 2014, 11:27:12 AM »
Hmm, I am not sure what in your setup or program is causing this.  I have posted some images below, one with our logo and the other with one of your screens that I replicated.  You can see in both photos there is no streaking on the display.  I have also included the code running for this below.

Code: [Select]
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Instruction Setting
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Set_Column_Address_12864(unsigned char a, unsigned char b)
{
oled_Command(0x15); // Set Column Address
oled_Command(a); //   Default => 0x00
oled_Command(b); //   Default => 0x3F (Total Columns Devided by 2)
}


void Set_Row_Address_12864(unsigned char a, unsigned char b)
{
oled_Command(0x75); // Set Row Address
oled_Command(a); //   Default => 0x00
oled_Command(b); //   Default => 0x4F
}


void Set_Contrast_Current_12864(unsigned char d)
{
oled_Command(0x81); // Set Contrast Value
oled_Command(d); //   Default => 0x40
}


void Set_Current_Range_12864(unsigned char d)
{
oled_Command(0x84|d); // Set Current Range
//   Default => 0x84
//     0x84 (0x00) => Quarter Current Range
//     0x85 (0x01) => Half Current Range
//     0x86 (0x02) => Full Current Range
}


void Set_Remap_Format_12864(unsigned char d)
{
oled_Command(0xA0); // Set Re-Map & Data Format
oled_Command(d); //   Default => 0x00
//     Column Address 0 Mapped to SEG0
//     Disable Nibble Re-Map
//     Horizontal Address Increment
//     Scan from COM0 to COM[N-1]
//     Disable COM Split Odd Even
}


void Set_Start_Line_12864(unsigned char d)
{
oled_Command(0xA1); // Set Display Start Line
oled_Command(d); //   Default => 0x00
}


void Set_Display_Offset_12864(unsigned char d)
{
oled_Command(0xA2); // Set Display Offset
oled_Command(d); //   Default => 0x00
}


void Set_Display_Mode_12864(unsigned char d)
{
oled_Command(0xA4|d); // Set Display Mode
//   Default => 0xA4
//     0xA4 (0x00) => Normal Display
//     0xA5 (0x01) => Entire Display On, All Pixels Turn On at GS Level 15
//     0xA6 (0x02) => Entire Display Off, All Pixels Turn Off
//     0xA7 (0x03) => Inverse Display
}


void Set_Multiplex_Ratio_12864(unsigned char d)
{
oled_Command(0xA8); // Set Multiplex Ratio
oled_Command(d); //   Default => 0x5F
}


void Set_Master_Config_12864(unsigned char d)
{
oled_Command(0xAD); // Set Master Configuration
oled_Command(0x02|d); //   Default => 0x03
//     0x02 (0x00) => Select External VCC Supply
//     0x03 (0x01) => Select Internal DC/DC Voltage Converter
}


void Set_Display_On_Off_12864(unsigned char d)
{
oled_Command(0xAE|d); // Set Display On/Off
//   Default => 0xAE
//     0xAE (0x00) => Display Off
//     0xAF (0x01) => Display On
}


void Set_Phase_Length_12864(unsigned char d)
{
oled_Command(0xB1); // Phase 1 & 2 Period Adjustment
oled_Command(d); //   Default => 0x53 (5 Display Clocks [Phase 2] / 3 Display Clocks [Phase 1])
//     D[3:0] => Phase 1 Period in 1~15 Display Clocks
//     D[7:4] => Phase 2 Period in 1~15 Display Clocks
}


void Set_Frame_Frequency_12864(unsigned char d)
{
oled_Command(0xB2); // Set Frame Frequency (Row Period)
oled_Command(d); //   Default => 0x25 (37 Display Clocks)
}


void Set_Display_Clock_12864(unsigned char d)
{
oled_Command(0xB3); // Display Clock Divider/Osciallator Frequency
oled_Command(d); //   Default => 0x41
//     D[3:0] => Display Clock Divider
//     D[7:4] => Oscillator Frequency
}


void Set_Precharge_Compensation_12864(unsigned char a, unsigned char b)
{
oled_Command(0xB4); // Set Pre-Charge Compensation Level
oled_Command(b); //   Default => 0x00 (No Compensation)

if(a == 0x20)
{
oled_Command(0xB0); // Set Pre-Charge Compensation Enable
oled_Command(0x08|a); //   Default => 0x08
//     0x08 (0x00) => Disable Pre-Charge Compensation
//     0x28 (0x20) => Enable Pre-Charge Compensation
}
}


void Set_Precharge_Voltage_12864(unsigned char d)
{
oled_Command(0xBC); // Set Pre-Charge Voltage Level
oled_Command(d); //   Default => 0x10 (Connect to VCOMH)
}


void Set_VCOMH_12864(unsigned char d)
{
oled_Command(0xBE); // Set Output Level High Voltage for COM Signal
oled_Command(d); //   Default => 0x1D (0.81*VREF)
}


void Set_VSL_12864(unsigned char d)
{
oled_Command(0xBF); // Set Segment Low Voltage Level
oled_Command(0x02|d); //   Default => 0x0E
//     0x02 (0x00) => Keep VSL Pin Floating
//     0x0E (0x0C) => Connect a Capacitor between VSL Pin & VSS
}


void GA_Option_12864(unsigned char d)
{
oled_Command(0x23); // Graphic Acceleration Command Options
oled_Command(d); //   Default => 0x01
//     Enable Fill Rectangle
//     Disable Wrap around in Horizontal Direction During Copying & Scrolling
//     Disable Reverse Copy
}


void Draw_Rectangle_12864(unsigned char a, unsigned char b, unsigned char c, unsigned char d, unsigned char e)
{
oled_Command(0x24); // Draw Rectangle
oled_Command(a); //   Column Address of Start
oled_Command(c); //   Row Address of Start
oled_Command(b); //   Column Address of End (Total Columns Devided by 2)
oled_Command(d); //   Row Address of End
oled_Command(e); //   Gray Scale Level
OLED_uDelay(200);
}


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Show Regular Pattern (Full Screen)
//
//    a: Two Pixels Data
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Fill_RAM_12864(unsigned char a)
{
GA_Option_12864(0x01);
Draw_Rectangle_12864(0x00,0x3F,0x00,0x5F,a);
}


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Show Regular Pattern (Partial or Full Screen)
//
//    a: Column Address of Start
//    b: Column Address of End (Total Columns Devided by 2)
//    c: Row Address of Start
//    d: Row Address of End
//    e: Two Pixels Data
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Fill_Block_12864(unsigned char a, unsigned char b, unsigned char c, unsigned char d, unsigned char e)
{
GA_Option_12864(0x01);
Draw_Rectangle_12864(a,b,c,d,e);
}


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Show Checkboard (Full Screen)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Checkerboard_12864()
{
unsigned char i,j;

Set_Column_Address_12864(0x00,0x3F);
Set_Row_Address_12864(0x00,0x5F);

for(i=0;i<40;i++)
{
for(j=0;j<64;j++)
{
oled_Data(0xF0);
}
for(j=0;j<64;j++)
{
oled_Data(0x0F);
}
}
}


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Show Gray Scale Bar (Full Screen)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Grayscale_12864()
{
//   Level 16 => Column 1~8
Fill_Block_12864(0x00,0x03,0x00,0x3F,0xFF);

//   Level 15 => Column 9~16
Fill_Block_12864(0x04,0x07,0x00,0x3F,0xEE);

//   Level 14 => Column 17~24
Fill_Block_12864(0x08,0x0B,0x00,0x3F,0xDD);

//   Level 13 => Column 25~32
Fill_Block_12864(0x0C,0x0F,0x00,0x3F,0xCC);

//   Level 12 => Column 33~40
Fill_Block_12864(0x10,0x13,0x00,0x3F,0xBB);

//   Level 11 => Column 41~48
Fill_Block_12864(0x14,0x17,0x00,0x3F,0xAA);

//   Level 10 => Column 49~56
Fill_Block_12864(0x18,0x1B,0x00,0x3F,0x99);

//   Level 9 => Column 57~64
Fill_Block_12864(0x1C,0x1F,0x00,0x3F,0x88);

//   Level 8 => Column 65~72
Fill_Block_12864(0x20,0x23,0x00,0x3F,0x77);

//   Level 7 => Column 73~80
Fill_Block_12864(0x24,0x27,0x00,0x3F,0x66);

//   Level 6 => Column 81~88
Fill_Block_12864(0x28,0x2B,0x00,0x3F,0x55);

//   Level 5 => Column 89~96
Fill_Block_12864(0x2C,0x2F,0x00,0x3F,0x44);

//   Level 4 => Column 97~104
Fill_Block_12864(0x30,0x33,0x00,0x3F,0x33);

//   Level 3 => Column 105~112
Fill_Block_12864(0x34,0x37,0x00,0x3F,0x22);

//   Level 2 => Column 113~120
Fill_Block_12864(0x38,0x3B,0x00,0x3F,0x11);

//   Level 1 => Column 121~128
Fill_Block_12864(0x3C,0x3F,0x00,0x3F,0x00);
}


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Show Character (5x7)
//
//    a: Database
//    b: Ascii
//    c: Start X Address
//    d: Start Y Address
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Show_Font57_12864(unsigned char a, unsigned char b, unsigned char c, unsigned char d)
{
unsigned char *Src_Pointer=0;
unsigned char i,Font,MSB,LSB;

switch(a)
{
case 1:
Src_Pointer=&Ascii_1[(b-1)][0];
break;
case 2:
//Src_Pointer=&Ascii_2[(b-1)][0];
break;
}

Set_Remap_Format_12864(0x54);
for(i=0;i<=4;i+=2)
{
LSB=*Src_Pointer;
Src_Pointer++;
if(i == 4)
{
MSB=0x00;
}
else
{
MSB=*Src_Pointer;
Src_Pointer++;
}
  Set_Column_Address_12864(c,c);
Set_Row_Address_12864(d,d+7);

Font=((MSB&0x01)<<4)|(LSB&0x01);
Font=Font|(Font<<1)|(Font<<2)|(Font<<3);
oled_Data(Font);

Font=((MSB&0x02)<<3)|((LSB&0x02)>>1);
Font=Font|(Font<<1)|(Font<<2)|(Font<<3);
oled_Data(Font);

Font=((MSB&0x04)<<2)|((LSB&0x04)>>2);
Font=Font|(Font<<1)|(Font<<2)|(Font<<3);
oled_Data(Font);

Font=((MSB&0x08)<<1)|((LSB&0x08)>>3);
Font=Font|(Font<<1)|(Font<<2)|(Font<<3);
oled_Data(Font);

Font=((MSB&0x10)<<3)|((LSB&0x10)>>1);
Font=Font|(Font>>1)|(Font>>2)|(Font>>3);
oled_Data(Font);

Font=((MSB&0x20)<<2)|((LSB&0x20)>>2);
Font=Font|(Font>>1)|(Font>>2)|(Font>>3);
oled_Data(Font);

Font=((MSB&0x40)<<1)|((LSB&0x40)>>3);
Font=Font|(Font>>1)|(Font>>2)|(Font>>3);
oled_Data(Font);

Font=(MSB&0x80)|((LSB&0x80)>>4);
Font=Font|(Font>>1)|(Font>>2)|(Font>>3);
oled_Data(Font);
c++;
}
Set_Remap_Format_12864(0x50);
}


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Show String
//
//    a: Database
//    b: Start X Address
//    c: Start Y Address
//    * Must write "0" in the end...
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Show_String_12864(unsigned char a, unsigned char *Data_Pointer, unsigned char b, unsigned char c)
{
unsigned char *Src_Pointer;

Src_Pointer=Data_Pointer;
Show_Font57_12864(1,96,b,c); // No-Break Space
//   Must be written first before the string start...

while(1)
{
Show_Font57_12864(a,*Src_Pointer,b,c);
Src_Pointer++;
b+=3;
if(*Src_Pointer == 0) break;
}
}


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Show Pattern (Partial or Full Screen)
//
//    a: Column Address of Start
//    b: Column Address of End (Total Columns Divided by 2)
//    c: Row Address of Start
//    d: Row Address of End
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Show_Pattern_12864(unsigned char *Data_Pointer, unsigned char a, unsigned char b, unsigned char c, unsigned char d)
{
unsigned char *Src_Pointer;
unsigned char i,j;

Src_Pointer=Data_Pointer;
Set_Column_Address_12864(a,b);
Set_Row_Address_12864(c,d);

for(i=0;i<(d-c+1);i++)
{
for(j=0;j<(b-a+1);j++)
{
oled_Data(*Src_Pointer);
Src_Pointer++;
}
}
}


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Vertical Scrolling (Full Screen)
//
//    a: Scrolling Direction
//       "0x00" (Upward)
//       "0x01" (Downward)
//    b: Set Numbers of Row Scroll per Step
//    c: Set Time Interval between Each Scroll Step
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void Set_Gray_Scale_Table_12864()
{
oled_Command(0xB8); // Set Gray Scale Table
oled_Command(0x01); //   Gray Scale Level 1
oled_Command(0x11); //   Gray Scale Level 3 & 2
oled_Command(0x22); //   Gray Scale Level 5 & 4
oled_Command(0x32); //   Gray Scale Level 7 & 6
oled_Command(0x43); //   Gray Scale Level 9 & 8
oled_Command(0x54); //   Gray Scale Level 11 & 10
oled_Command(0x65); //   Gray Scale Level 13 & 12
oled_Command(0x76); //   Gray Scale Level 15 & 14
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  Initialization
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void OLED_12864_Init()
{
unsigned char i;
Max_Column = 0x3F; // 128/2-1 (Total Columns Devided by 2)
Max_Row = 0x3F; // 64-1
Brightness = 0x7F;
GPIO_ResetBits(GPIOC, RES);
for(i=0;i<200;i++)
{
OLED_uDelay(200);
}
GPIO_SetBits(GPIOC, RES); 

Set_Display_On_Off_12864(0x00); // Display Off (0x00/0x01)
Set_Display_Clock_12864(0x91); // Set Clock as 135 Frames/Sec
Set_Multiplex_Ratio_12864(0x3F); // 1/64 Duty (0x0F~0x5F)
Set_Display_Offset_12864(0x4C); // Shift Mapping RAM Counter (0x00~0x5F)
Set_Start_Line_12864(0x00); // Set Mapping RAM Display Start Line (0x00~0x5F)
Set_Master_Config_12864(0x00); // Disable Embedded DC/DC Converter (0x00/0x01)
Set_Remap_Format_12864(0x50); // Set Column Address 0 Mapped to SEG0
//     Disable Nibble Remap
//     Horizontal Address Increment
//     Scan from COM[N-1] to COM0
//     Enable COM Split Odd Even
Set_Current_Range_12864(0x02); // Set Full Current Range
Set_Gray_Scale_Table_12864(); // Set Pulse Width for Gray Scale Table
Set_Contrast_Current_12864(Brightness); // Set Scale Factor of Segment Output Current Control
Set_Frame_Frequency_12864(0x51); // Set Frame Frequency
Set_Phase_Length_12864(0x55); // Set Phase 1 as 5 Clocks & Phase 2 as 5 Clocks
Set_Precharge_Voltage_12864(0x10); // Set Pre-Charge Voltage Level
Set_Precharge_Compensation_12864(0x20,0x02); // Set Pre-Charge Compensation
Set_VCOMH_12864(0x1C); // Set High Voltage Level of COM Pin
Set_VSL_12864(0x0D); // Set Low Voltage Level of SEG Pin
Set_Display_Mode_12864(0x00); // Normal Display Mode (0x00/0x01/0x02/0x03)

Fill_RAM_12864(0x00); // Clear Screen

Set_Display_On_Off_12864(0x01); // Display On (0x00/0x01)
}

Please make sure your code matches, and also double check your connections and voltage levels.  Make certain that there are no voltages being supplied to any pin on the OLED over the 3.5V max, and that you voltages are clean (with little to no noise).  You may also try putting a large capacitor across VDD and Ground, altough this is not present in the below images.

(The slightly darker diagonal bands you see are a result of the camera/refresh of the OLED, and are not seen in person.)
« Last Edit: August 07, 2014, 11:31:08 AM by Michael_L »

cherry8wild

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: NHD 2.7 Screen Image Streaking
« Reply #14 on: August 07, 2014, 11:30:16 AM »
Yea, taking pictures of the screens isn't easy. I'll go through the code and see if I see anywhere I am missing something. Thanks again, and hopefully my screen will look like that soon!

 

NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem

Started by hbcelebiBoard TFTs

Replies: 5
Views: 4327
Last post December 10, 2014, 11:19:05 AM
by Michael_L
Shift position after "clear screen" instruction

Started by dreissBoard OLEDs

Replies: 5
Views: 3217
Last post September 18, 2015, 03:50:30 PM
by Saurabh_B
Resistive/Capacitive Touch Screen - Sample Code

Started by daotaBoard TFTs

Replies: 1
Views: 1319
Last post July 14, 2016, 07:57:46 AM
by Saurabh_B
NHD-7.0CTP-CAPE use touch screen in portrait mode?

Started by ArnieBoard Evaluation Tools

Replies: 0
Views: 25
Last post December 14, 2017, 02:30:15 AM
by Arnie
NHD-7.0-800480EF-ATXV#-CTP touch screen details

Started by lakshminarayananBoard TFTs

Replies: 1
Views: 2854
Last post June 24, 2014, 10:33:38 AM
by Michael_L