Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ACM2004 LCD via I2C

Status
Not open for further replies.
Hello everyone,

I'm having difficulties coding my LCD panel via I2C protocol.
I've bought a Simple I2C I/O expander (pcf8574) which communicates via I2C with the lcd by using 4bit data transmission.
As stated in the lcd datasheet, in 4bit mode, MSBfirst, LSB second. I've made some I2C functions and tested them, yeah they work.

The problem now is that my LCD won't display anything. I've used a Logic Analyzer to see the I2C data's sent to the panel, which are the one I want.
I've already used a LCD via a 8bit data transmission system on a DataBus, so I kinda know how this beast works, but can't get it to work via I2C.

I'll include part of my code that may help you find the mistake instead of me :

I2C write function :

Code:
void vI2CEcrireDonnee8574 (UC ucDispositif, UC ucDonnee, UC ucRegistre)
{ 
    UC ucAckPolling;
    UC ucHighByte;
    UC ucLowByte;
    ucHighByte = ((ucDonnee & 0xF0) + ucRegistre);
    ucLowByte = (((ucDonnee & 0x0F) << 4) + ucRegistre);
    vI2CStart();                              //Start le I2C
    ucAckPolling = ucI2CEcrireOctet(ucDispositif);//Start  polling
    while (ucAckPolling == 1)                 //while ACK = NOACK
     {
        vI2CStart();                           //Start I2C
        ucAckPolling = ucI2CEcrireOctet(ucDispositif);//RE-send
     }        
    ucI2CEcrireOctet(ucHighByte);
    ucI2CEcrireOctet(ucLowByte);   
    vI2CStop();                               //Stop I2C 
}

and the I2C lcd setup function



Code:
void vLcdInitI2C(void)
{
    UC uci;
    for (uci=0; uci<3; uci++)
     {
        vI2CEcrireDonnee8574(ADRPCF8574, 0x28, CONTROLI2C);
        vDelaiEcranI2C(10000);
     }

    vI2CEcrireDonnee8574(ADRPCF8574, 0x28, CONTROLI2C);
    //vLcdBusyI2C();
    vDelaiEcranI2C(2000);
    vI2CEcrireDonnee8574(ADRPCF8574, 0x0F, CONTROLI2C);
    //vLcdBusyI2C();
    vDelaiEcranI2C(2000);
    vI2CEcrireDonnee8574(ADRPCF8574, 0x01, CONTROLI2C);
    //vLcdBusyI2C();
    vDelaiEcranI2C(2000);
    vI2CEcrireDonnee8574(ADRPCF8574, 0x06, CONTROLI2C);
    //vLcdBusyI2C();
    vDelaiEcranI2C(2000);
}

HELP please!!!! I need this one so bad!
 

Attachments

  • WASSUP.png
    WASSUP.png
    441 KB · Views: 161
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top