void CCFAG_WinTestDlg::OnInitialize()
{
/* deleted win specific stuff */
ubyte
i;
i=0;
//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;
}