Working on MSP432 - Part 11 (Interfacing MSP432 to 16x2 Alphanumeric LCD)

Working on MSP432 - Part 11 (Interfacing MSP432 to 16x2 Alphanumeric LCD)

Following pin configuration is done to interface MSP432 to Alphanumeric LCD. 

LCD Part Number ----------> JHD162A

JHD162A has KS0066U LCD driver. Generally, when design engineers use 2x16 Alphanumeric LCD, one of the confusion is whether they should use 5V or 3.3V for the VDD. Remember that most of the Alpha Numeric displays have operating voltage between 4.5V to 5.5V.

LCD---------->MSP432

  • VSS----------> GND
  • VDD---------->5V
  • Contrast pin---------->
  • Register Select---------->P2.5
  • Read/Write---------->P2.6
  • Enable---------->P2.7
  • D0---------->P4.0
  • D1---------->P4.1
  • D2---------->P4.2
  • D3---------->P4.3
  • D4---------->P4.4
  • D5---------->P4.5
  • D6---------->P4.6
  • D7---------->P4.7
  • LED +---------->5V
  • LED ----------->GND
Note: If the LED+ and LED- are not connected, LCD back light shall not come up. This should not hold your LCD from working but data may not be clearly visible.

Below are the common routines:

void LCD_init()
{
    LCD_cmd(0x38);  //2 lines and 5×7 matrix
    delay(25);
    LCD_cmd(0x0E);  //Display ON, Cursor Blinking
    delay(25);
    LCD_cmd(0x01);  //Clear Display
    delay(25);
    LCD_cmd(0x06);  //Increment cursor to right
    delay(25);
    LCD_cmd(0x80);  //Force cursor to beginning of the line
    delay(25);
    LCD_cmd(0x0C);  //Display ON, cursor OFF
    delay(25);
}

void LCD_cmd(unsigned char value)
{
    P4OUT |= (0xFFFF & value); //pushing the command to port

    //Setting RS, RW, EN output to P2.5, P.6, P2.7

    P2OUT &= 0xFFDF;    //RS = 0
    P2OUT &= 0xFFBF;    //RW = 0
    P2OUT |= 0x0080;    //EN = 1
    delay(25);
    P2OUT &= 0xFF7F;    //EN = 0
    delay(25);
}

void LCD_data(unsigned char value)
{
    P4OUT |= (0xFFFF & value); //pushing the data to port

    //Setting RS, RW, EN output to P2.5, P.6, P2.7

    P2OUT |= 0x0040;    //RS = 1
    P2OUT &= 0xFFBF;    //RW = 0
    P2OUT |= 0x0080;    //EN = 1
    delay(25);
    P2OUT &= 0xFF7F;    //EN = 0
    delay(25);
}

void delay(int count)
{
    int i,j;
    for(i = 0;i <= count;i++)
        for(j = 0;j <= count;j++);
}

Post a Comment

0 Comments