CFAG160160B Datasheet Mistake?

epilefreyes

New member
Well, I've my LCD working now, because I did read the original datasheet (Sanyo LC7981 controller) or I will never have it working. Why? A little mistake, in the Crystalfontz datasheet...

On page 15, in "Writting Display Data" it says: "Write code 0DH..." but, in the table, it is a 0Ch written on it. I confirm in the original Datasheet, and it's really 0Ch, just the table says. This is a little mistake, but some people, like me, who always trust in the datasheets and never verify, will have a lot of trouble with some details like that.

In the second part "Reading Display Data", it's the same mistake.

It's just to change one "0Dh" to "0Ch" and "0Ch" to "0Dh".

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

vado

New member
I didn't notice that, however I used 0x0C anyhow :p .

I posted earlier today about having a strobing effect when i try to test my CFAG160160B, did you have any problems?

I am setting up the 9 registers described in the crystalfontz datasheet, then trying to simply display the character 'A'.

For the address and counter positions I have used memory location 0x00.

Basically i am getting a strobing effect, or straight lines going vertically down the right hand side :(
 

epilefreyes

New member
Any problem...

No... I don't have any trouble now... I've put some images on the LCD, and it's working OK.

Try this:

My initialization sequence is (instruction - data, where instruction is using RS=1, data RS=0, RW=1 and enabled=1).

instruction,data
0x00,0x12 //Turn OFF display (while setup). Graphic Mode.
0x01,0x87 //Vp = 9, Hp = 8 (vertical - horiz. pitch)
0x02,0x13 // Hn = 20 (characters per line)
0x03,0xA0 //160: Duty cicle (HERE could be your problem... i've
// something similar, when I start working...
0x04,0x07 // Cp=8 (Cursor Position)
0x0A,0x00 //Starting RAM Address (low)
0x0B,0x00 //Starting RAM Address (up)

for(i=0;i<3200;i++)
0x0C,0x00 // 3.2kb RAM. Erased. (Using, 0x0C, of course)

0x0A,0x00 //Starting RAM Address (low)
0x0B,0x00 //Starting RAM Address (up)
0x00,0x32 // 0x32: Graphic Mode. 0x38: Text mode.

Just after this initialization, try:
0x0C,0x41 //It MUST put an "A" in the screen. If you haven't any,
move your potentiometer between Vdd,Vo and Vee.

I've made everything else exactly the Crystalfontz datasheet, and it's working fine. If you are using Microchip microcontroller, I could share with you my own C code about the LCD.
 

vado

New member
thank you for your reply, I will try this out this afternoon.

When you describe what control signals you are sending you mention that:

R/W = 1
enabled = 1

Do you leave enable 1 during instruction and data? or only during Data?

R/W =1. This may be a fundamental problem i am having. I have been having R/W =0 because i thought I was writing to the registers.
This means that R/W =1 (reading). I suppose this is respect to the LCD controller which is reading the inputs in to the registers.

Thank You, I look forward to working on this soon.
 

epilefreyes

New member
SORRY!!!!! :D

RW=0, it's a mistake, sorry. Of course, just as it is said by the datasheet...

Enabled = 1, only when I write or read. Usually, it's 0.

Good Luck!!!!!
 

Corinne

New member
hi

i am also using CFAG160160 but i still can't display anything from my screen...

just want to clear it out... with the program that you posted that would display letter A... where did you initialize your RS and R/W?

i'm quite desperate... in programming I am suppose to first access the intruction register then the mode register.... they are both 8 bits but according to the datasheet... the 9th and 10th bit are suppose to be the r/w and the rs

therefore... from your program... example I am setting the cursor position...

0x04,0x07 // this is from your program

i programmed this as...

PCOUT = 0X01; PEOUT = 0x04; // my PCOUT is the instruction reg for r/w and RS
PCOUT = 0x00; PEOUT = 0x07; // my PCPUT is the mode reg for r/w and RS

am i doing this right?!
 

epilefreyes

New member
Sorry... I'm not sure if I've understood you. Only for reference, (and if this could help you in best way) this is exactly my code in MPLAB C18 (C version of Microchip C Controllers).

NOTE: "CS=x" it's because I'm using three diferent pins in my microcontroller to control CS of all my devices (memory, display...) so, assume "CS=x" like "Put x in Display CS".
Code:
******************************************
void write_video(byte instruction, byte data){
    byte busyflag;
    busyflag = 0x80; //7th byte ON. Just to enter WHILE
                CS=1; //Display CS
    PORTBbits.RB3 = 1; //Enabled = 1; (Activate)

    PORTBbits.RB0 = 1; //RS = 1
    PORTBbits.RB1 = 0; //R/W = 0 (writting)

    /* Write Instruction */
    TRISD = 0; //This puts all PORTD as outputs
    PORTD = instruction; // I wrote the instruction
                CS=0; //Enable Display
    Delay10TCYx(1); //Wait 320ns.
                CS=1; //Disable Display
    PORTBbits.RB3 = 0; //Enabled = 0 (Deactivate)

    /* Write Data */
    PORTBbits.RB0 = 0; //RS = 0
    PORTD = data; //Writes Data
                CS=0;
    PORTBbits.RB3 = 1; //Enabled = 1; (Activate)
    Delay10TCYx(1);  //Wait 320ns.
    PORTBbits.RB3 = 0; //Enabled=0; (Deactivate)
                CS=1; //Disable Display

    /* Readin "Busy" Flag */
    
    PORTBbits.RB0 = 1; //RS = 1
    PORTBbits.RB1 = 1; //R/W = 1 (reading)
    TRISD = 0xFF; //Port D as Inputs

    while (busyflag == 0x80){
        CS=0;
        PORTBbits.RB3 = 1; //Enable = 1 (Activate)
        Delay1TCY();  //Wait 16ns;
        Delay1TCY();  //Wait 16ns;
    
        busyflag = PORTD;
        busyflag = (busyflag & 0x80); //Just Reading 7th. bit
    
        PORTBbits.RB3 = 0; //Enable = 0 (Deactivate)
        CS=1; //Disable Display
        Delay10TCYx(1);  //Wait 160ns
        }
    }
******************************************
And then, using this, I've made this initialization function:
Code:
******************************************

void startup_display(void){
    unsigned int i;
    
    write_video(0x00,0x12); //Display OFF (during initialization)
    write_video(0x01,0x87);
    write_video(0x02,0x13);
    write_video(0x03,0xA0);
    write_video(0x04,0x07);
    write_video(0x0A,0x00);
    write_video(0x0B,0x00);

    //Erase all video memory (3.2Kbytes)
    for(i=0;i<3200;i++)
        write_video(0x0C,0x00); 

    /* Puts into memory position 0,0*/
    write_video(0x0A,0x00);
    write_video(0x0B,0x00);
    write_video(0x00,0x32); //Turn ON display, graphic mode

    }

******************************************
NOTE 2: If you put:
Code:
    write_video(0x00,0x38); //Turn ON display, text mode
    write_video(0x0C,0x41); //Displays "A"
It MUST put an "A".

I wrote this code and it works fine.

If you need help, just write me: felipe(at}tecnoconsulta(dot]com (edit to '@' & '.')
 
Top