initializing command for CGM 064128f

anjaz

New member
hi,

AM trying to configure CGM 064128f Graphical lcd i need to get the initializing commands of this LCD(HEX code)

i will b thankful if u culd mail me the details .............
with the purpose of the HEX code u suggested

i have the datasheet with me available but am trying to configure graphical lcd first time so needed only the improtant commands the HEX codes needed to initialize the Graphical LCD .........
it uses KS0713 controller samsung

mail id: anjaz (dot) v (at) gmail (dot) com
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

CF Tech

Administrator
This demonstration code:

http://www.crystalfontz.com/software/CFAX_WinTest/index.html

Should work with a KS0713.

Look in the source zip file for "CFAX_WINTESTDlg.cpp". Within that file you need "OnInitialize()":
Code:
typedef unsigned char ubyte;

ubyte
  control;  //value of "*port_control_address"

#define DATA_ADDR (port_data_address)
#define CONT_ADDR (port_control_address)

//inverted at the port
#define CLR_RD (DlPortWritePortUchar(CONT_ADDR,(control|=0x01)))
#define SET_RD (DlPortWritePortUchar(CONT_ADDR,(control&=~0x01)))
  
//inverted at the port
#define CLR_WR (DlPortWritePortUchar(CONT_ADDR,(control|=0x02)));(Sleep(1))
#define FCLR_WR (DlPortWritePortUchar(CONT_ADDR,(control|=0x02)))
#define SET_WR (DlPortWritePortUchar(CONT_ADDR,(control&=~0x02)))
  
//straight at the port
#define SET_RS (DlPortWritePortUchar(CONT_ADDR,(control|=0x04)))
#define CLR_RS (DlPortWritePortUchar(CONT_ADDR,(control&=~0x04)))

//inverted at the port
#define CLR_RES (DlPortWritePortUchar(CONT_ADDR,(control|=0x08)))
#define SET_RES (DlPortWritePortUchar(CONT_ADDR,(control&=~0x08)))

#define DATA(x) (DlPortWritePortUchar(DATA_ADDR,(x)));(Sleep(1))
#define FDATA(x) (DlPortWritePortUchar(DATA_ADDR,(x)))

void CCFAX_WINTESTDlg::OnInitialize() 
  {
  /* removed windows stuff */
  ubyte
    i;
  i=0;

  //Idle RW and WR
  SET_RD;
  SET_WR;

  //Talk to the control register.
  CLR_RS;

  //Strobe the reset. It is already low.
  //Stay in reset while the power settles down
  CLR_RES;
  Sleep(100);
  SET_RES;
  Sleep(100);

  //Software reset command
  DATA(0xE2);
  CLR_WR;
  SET_WR;
  Sleep(100);

  //Display on
  DATA(0xAF);
  CLR_WR;
  SET_WR;
  Sleep(100);

  //Display normal EON
  DATA(0xA4);
  CLR_WR;
  SET_WR;
  Sleep(10);

  //Display normal REV
  DATA(0xA6);
  CLR_WR;
  SET_WR;
  Sleep(10);


  //LCD Bias (A2 A3)
  DATA(0xA3);
  CLR_WR;
  SET_WR;
  Sleep(10);


  //ADC (A0, A1) (Flips display left to right, assuming landscape orientation)
  DATA(0xA1);
  CLR_WR;
  SET_WR;
  Sleep(10);

  //SHL (C8 C0) (Flips display top to bottom, assuming landscape orientation)
  DATA(0xC0);
  CLR_WR;
  SET_WR;
  Sleep(10);

  //VC
  DATA(0x2C);
  CLR_WR;
  SET_WR;
  Sleep(10);

  //VR
  DATA(0x2E);
  CLR_WR;
  SET_WR;
  Sleep(10);

  //VF
  DATA(0x2F);
  CLR_WR;
  SET_WR;
  Sleep(10);

  //Resistor (20 - 27)
  //This acts like a "range" contol on the contrast. 7 = dark 6 = OK, all others too light.
  DATA(0x20|(last_range&0x07));
  CLR_WR;
  SET_WR;
  Sleep(10);

  //Contrast (81 + 0 - 3F)
  DATA(0x81);
  CLR_WR;
  SET_WR;
  Sleep(10);

  DATA(last_contrast&0x3F);
//  DATA(0x1F);
  CLR_WR;
  SET_WR;
  Sleep(10);


  //Stabilize
  Sleep(100);


  //Static Indicator (not working)
  DATA(0xAD);
  CLR_WR;
  SET_WR;
  Sleep(1);

  DATA(0x02);  //1/2 sec blink
  CLR_WR;
  SET_WR;
  Sleep(1);

  //Initial Display Line
  DATA(0x40);
  CLR_WR;
  SET_WR;
  Sleep(1);

  //Page Address
  DATA(0xB0);
  CLR_WR;
  SET_WR;
  Sleep(1);

  //High Column
  DATA(0x10);
  CLR_WR;
  SET_WR;
  Sleep(1);

  //Low Column
  DATA(0x00);
  CLR_WR;
  SET_WR;
  Sleep(1);

  ubyte
    data;
  data=0xFF;
  int
    row;
  for(row=0;row<=7;row++)
    {
    //Page Address
    DATA(0xB0|row);
    CLR_WR;
    SET_WR;
    Sleep(1);

    //High Column
    DATA(0x10);
    CLR_WR;
    SET_WR;
    Sleep(1);

    //Low Column For some reason the Left-most column of the
    //CFAX12864 is at 4. Hmmm.
    DATA(0x04);
    CLR_WR;
    SET_WR;
    Sleep(1);


    SET_RS;
    int
      col;
    for(col=0;col<=127;col++)
      {
      FDATA(display_type?cfax12864c[row][col]:cfax12864a[row][col]);
		  FCLR_WR;
		  SET_WR;
      data^=0xFF;
      }
    CLR_RS;
    }
	
}
 
Top