Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - carlosflr

Pages: [1]
1
Character LCDs / Re: NHD-C0216CiZ-FSW-FBW-3V3
« on: August 08, 2015, 07:35:57 AM »
I checked my I2C timing and it was too fast. I fixed this and now I see the correct strings on the display. Thanks for your help Michael.

2
Character LCDs / Re: NHD-C0216CiZ-FSW-FBW-3V3
« on: August 07, 2015, 11:48:40 AM »
I just increased all my delays to 500 ms, including the delays in the initialization routine. I can see how each character is displayed. However, the display looks the same. Anything else that could be wrong?

Thanks,
Carlos

3
Character LCDs / NHD-C0216CiZ-FSW-FBW-3V3
« on: August 07, 2015, 11:21:25 AM »
I am trying to use the NHD-C0216CiZ-FSW-FBW-3V3 display with a Kinetis microcontroller (Cortex M4). I think I'm following the datasheet for the initialization routine and to send data. However, the display doesn't show the proper data. The first five characters of the first row are missing. The rest of the characters on the same line are shifted to the right. The second line looks OK. I'm attaching an image of how it looks. I tried this with two boards and it looks the same so I assume I am doing something wrong in my code.

I would appreciate any help you can provide.

Thanks,
Carlos

This is my code:

Code: [Select]
void vfnLCDInit(void)
{
    // send LCD reset pulse
    GPIOD_PCOR |= (1 << LCD_RST);
    GPIOD_PDDR |= (1 << LCD_RST);
    SysTickWait(0.0005);
    GPIOD_PSOR |= (1 << LCD_RST);
    SysTickWait(0.001);

    // disable backlight by default
    GPIOD_PCOR |= (1 << LCD_BK);
    GPIOD_PDDR |= (1 << LCD_BK);

    //Function Set
    ST7032iCommandWrite(0x38);
    SysTickWait(0.000030);

    //Function Set
    ST7032iCommandWrite(0x39);
    SysTickWait(0.000030);

    //Bias and OSC frequency
    ST7032iCommandWrite(0x14);
    SysTickWait(0.000030);

    //Contrast set
    ST7032iCommandWrite(0x72);
    SysTickWait(0.000030);

    //Power
    ST7032iCommandWrite(0x5E);
    SysTickWait(0.000030);

    //Follower control
    ST7032iCommandWrite(0x6D);
    SysTickWait(0.000030);

    //Display control : on
    ST7032iCommandWrite(0x0C);
    SysTickWait(0.000030);

    //Clear
    ST7032iCommandWrite(0x01);
    SysTickWait(0.002);

    //Entry mode
    ST7032iCommandWrite(0x06);

    // wait 100 ms
    SysTickWait(0.1);
}

void vfnLCDPutString(int8_t x, int8_t y, int8_t String[])
{
  uint8_t i = 0;
  uint8_t addr;

  if (y == 1)
    addr = 0x00;
  else if (y == 2)
    addr = 0x40;
  else
    return;

  addr += (x - 1);

  ST7032iCommandWrite(0x80 | addr);
  SysTickWait(0.000030);

  while(String[i] != '\0')
  {
    ST7032iPutchar(String[i]);
    i++;
  }
}

void ST7032iPutchar(int8_t chardata)
{
  uint32_t i;

  ST7032iDataWrite((uint8_t)chardata);
  SysTickWait(0.000030);
}

void ST7032iCommandWrite(uint8_t Data)
{
  uint8_t buf[2];
  buf[0] = 0x00;
  buf[1] = Data;
  ST7032ii2cWrite(buf, 2);
}

void ST7032iDataWrite(uint8_t Data)
{
  uint8_t buf[2];
  buf[0]= 0x40;
  buf[1] = Data;
  ST7032ii2cWrite(buf, 2);
}

on main...

vfnLCDInit();
vfnLCDPutString(1,1,"0123456789abcdef");
vfnLCDPutString(1,2,"0123456789ABCDEF");


Pages: [1]