CFAG160160 Initialisation

Tot

New member
I have searched the forums for an answer, but to no avail!! Am about to get a hammer out, but thought I'd send a message first!

I cannot get my display to work.

I am biasing Vo externally to -3.5V (onboard generator appears to have failed). Varying this all the way to -12V doesn't do a thing!

To send a command I do the following:
/CS =0, R/W=0, RS=1, E =0
Place instruction on bus
1us delay
E=1
1us delay
E=0
2ms delay
RS=0
Place data on bus
repeat toggling of E with same delays

Is this incorrect? Scoping the board out this is definitely what is being sent.

My question is:
What eactly do I have to send as initialisation codes? Can I just send MODE?

Currently I am sending the following (with the above timings):

INSTRUC. DATA

MODE (0x00) 0x2C (character, slave)
CHAR PITCH 0x87
NO.OF CHARS 0x13
TIME DIV 0x9F
CURSOR POS 0x07
DISP START LOW 0x00
DISP START HIGH 0x00
CURSOR START LOW 0x00
CURSOR START HIGH 0x00

I then attempt to write a digit to the screen:
WRITE(0x0C) 0x41 (letter 'A')

...and nothing happens!


Please help, I have downloaded the 160160_wintest directory but none of it makes sense (I am writing in plain C here).

Regards,
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Tot

New member
Yup, saw that, but can't make head or tail of the source. Is there a specific file in there I can look at?

Thanks,
 

CF Tech

Administrator
You are looking for "void CCFAG_WinTestDlg::OnInitialize()" in CFAG_WinTestDlg.cpp:
Code:
  //Idle the control lines & reset the display
  CLR_RES;
  CLR_E;
  CLR_RS;
  SET_CS;
  DATA(0);
  Sleep(10);
  SET_RES;
  Sleep(10);

  //MOV     COMM_REG,#00H           ;Command code--Mode control
  //MOV     DATA_REG,#32H           ;Set 00110010
  //LCALL   CP_COMMAND              ;Command complete
  CP_COMMAND(0x00,0x32);

  //MOV     COMM_REG,#01H           ;Character pitch setting
  //MOV     DATA_REG,#77H           ;Set 10010111
  //LCALL   CP_COMMAND              ;Command complete
  CP_COMMAND(0x01,0x77);

  //MOV     COMM_REG,#02H           ;Character number setting
  //MOV     DATA_REG,#19            ;160/8=20 Char in one line
  //LCALL   CP_COMMAND              ;Command complete
  CP_COMMAND(0x02,19);

  //MOV     COMM_REG,#03H           ;Display duty setting
  //MOV     DATA_REG,#MaxRow_1      ;Set 1/160 duty
  //LCALL   CP_COMMAND              ;Command complete
  CP_COMMAND(0x03,159);

  //MOV     COMM_REG,#08H           ;Display low address setting
  //MOV     DATA_REG,#00H           ;Low address start from 00H
  //LCALL   CP_COMMAND              ;Command complete
  CP_COMMAND(0x08,0x00);

  //MOV     COMM_REG,#09H           ;Display high address setting
  //MOV     DATA_REG,#00H           ;High address start from 00
  //LCALL   CP_COMMAND              ;Command complete
  CP_COMMAND(0x09,0x00);

  //FULLON:
  //MOV     COMM_REG,#0AH           ;Cursor low address setting
  //MOV     DATA_REG,#00H           ;Low address start from 00H
  //LCALL   CP_COMMAND              ;Command complete
  CP_COMMAND(0x0A,0x00);

  //MOV     COMM_REG,#0BH           ;Cursor high address setting
  //MOV     DATA_REG,#00H           ;High address start from 00
  //LCALL   CP_COMMAND              ;Command complete
  CP_COMMAND(0x0B,0x00);

  int
    row,col;
  CLR_CS;
  //Send data command
  DATA(0x0C);
  SET_RS;
  //R/W is hardwired low
  SET_E;
  CLR_E;
  CLR_RS;
  for(row=0;row<=159;row++)
    for(col=0;col<=19;col++)
      {
      DATA(cfag240128[row][col]);
      //R/W is hardwired low
      SET_E;
      CLR_E;
      }
  SET_CS;
 
Top