Author Topic: NHD-C0220BiZ-FSW-FBW-3V3M stucking at "39"  (Read 351 times)

amitjagtap

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
NHD-C0220BiZ-FSW-FBW-3V3M stucking at "39"
« on: March 18, 2019, 12:13:46 AM »
Sir,
We are using NHD-C0220BiZ-FSW-FBW-3V3M LCD. We write I2C code using bit banging.
We are not getting ACK for "0x39" command....
Kindly help out to resolve this issue.
ALSO let us know what I2C slave address we should use...as I have seen in forum  post "3C" used instead of "78".

This is our code....
void LCD_GPIO_INIT()
{
    gpio_pin_config_t LCD_I2C_SCL_config = {
        kGPIO_DigitalOutput, 1,
    };
    gpio_pin_config_t LCD_I2C_SDA_config = {
        kGPIO_DigitalOutput, 1,
    };

    gpio_pin_config_t LCD_THERMAL_SD_config = {
        kGPIO_DigitalOutput, 1,
    };

    /*Init TX_EN High*/
    GPIO_PinInit(GPIOC, 10, &LCD_I2C_SCL_config);
 
    /*Init RX_EN Low*/
    GPIO_PinInit(GPIOC, 11, &LCD_I2C_SDA_config);
   GPIO_PinInit(GPIOA, 26, &LCD_THERMAL_SD_config);

}

/****************************************************
* I2C Start *
*****************************************************/
void I2C_Start(void)
{
//SCL=1;
//SDA=1;
//SDA=0;
//SCL=0;
  GPIO_PinWrite(GPIOC, 10,1);
  GPIO_PinWrite(GPIOC, 11,1);
  GPIO_PinWrite(GPIOC, 11,0);
  GPIO_PinWrite(GPIOC, 10,0);


}
/*****************************************************/
/****************************************************
* I2C Stop *
*****************************************************/
void I2C_Stop(void)
{
//SDA=0;
//SCL=0;
//SCL=1;
//SDA=1;

  GPIO_PinWrite(GPIOC, 11,0);
  GPIO_PinWrite(GPIOC, 10,0);
  GPIO_PinWrite(GPIOC, 10,1);
  GPIO_PinWrite(GPIOC, 11,1);
}




/****************************************************
* Output command or data via I2C *
*****************************************************/
void I2C_out(unsigned char j) //I2C Output
{
  int n;
      gpio_pin_config_t LCD_I2C_SDA_config_out = {
        kGPIO_DigitalOutput, 1,
    };
         gpio_pin_config_t LCD_I2C_SDA_config_in = {
        kGPIO_DigitalInput, 1,
    };

  uint8_t d;
  d=j;
  for(n=0;n<8;n++)
  {
    if((d&0x80)==0x80)
      GPIO_PinWrite(GPIOC, 11,1);//SDA=1;
    else
      GPIO_PinWrite(GPIOC, 11,0); //SDA=0;
    d=(d<<1);
    cdelay();
    GPIO_PinWrite(GPIOC, 10,0); //SCL = 0;
    cdelay();
    GPIO_PinWrite(GPIOC, 10,1); //SCL = 1;
    cdelay();
    GPIO_PinWrite(GPIOC, 10,0); //SCL = 0;
  }
 cdelay();
  GPIO_PinWrite(GPIOC, 10,1);//SCL = 1;
   GPIO_PinInit(GPIOC, 11, &LCD_I2C_SDA_config_in);
 
cdelay();
 while(GPIO_PinRead(GPIOC,11) == 1)// while(SDA==1)
  {
    GPIO_PinWrite(GPIOC, 10,0); //SCL=0;
      cdelay();
    GPIO_PinWrite(GPIOC, 10,1); //SCL=1;
      cdelay();
  }
    GPIO_PinInit(GPIOC, 11, &LCD_I2C_SDA_config_out);

 GPIO_PinWrite(GPIOC, 10,0); //SCL=0;
 cdelay();
}



/****************************************************
* Initialization For ST7036i *
*****************************************************/
void init_LCD()
{
  I2C_Start();
  I2C_out(Slave);//Slave=0x78
  I2C_out(Comsend);//Comsend = 0x00
  I2C_out(0x38);
  delay(10);
  delay(10);
  I2C_out(0x39);
  delay(10);
  delay(10);
  I2C_out(0x14);
  I2C_out(0x78);
  I2C_out(0x5E);
  I2C_out(0x6D);
  I2C_out(0x0C);
  I2C_out(0x01);
  I2C_out(0x06);
  delay(10);
  I2C_Stop();
}

/****************************************************
* Send string of ASCII data to LCD *
*****************************************************/
void Show(unsigned char *text)
{
  int n,d;
  d=0x00;
  I2C_Start();
  I2C_out(Slave); //Slave=0x78
  I2C_out(Datasend);//Datasend=0x40
  for(n=0;n<20;n++){
  I2C_out(*text);
  ++text;
  }
  I2C_Stop();
}

int lcd_test()
{
  uint8_t data[]={0x41, 0x42, 0x43, 0x44};
  LCD_GPIO_INIT();
  init_LCD();
  Show(data);
}
« Last Edit: March 18, 2019, 12:18:10 AM by amitjagtap »

amitjagtap

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: NHD-C0220BiZ-FSW-FBW-3V3M stucking at "39"
« Reply #1 on: March 18, 2019, 05:35:11 AM »
Pin 6 Voltage is 2.94V.

 

NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM capacitor on pin 7&8

Started by Ticoti0xFFBoard Character LCDs

Replies: 1
Views: 5408
Last post April 09, 2014, 10:17:30 AM
by Michael_L
NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM Potting

Started by SebKisterBoard Character LCDs

Replies: 1
Views: 4415
Last post June 22, 2016, 04:51:17 PM
by Saurabh_B
Blank Display on NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM

Started by SteveCBoard Character LCDs

Replies: 3
Views: 10128
Last post May 13, 2014, 12:04:36 AM
by SteveC
NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM - Cable for LED Backlights

Started by wadehBoard Character LCDs

Replies: 2
Views: 3513
Last post December 02, 2016, 06:02:27 PM
by wadeh
Sample Code Question for NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM LCD

Started by SteveCBoard Character LCDs

Replies: 2
Views: 6811
Last post July 31, 2014, 08:44:29 PM
by SteveC