Blogger Widgets

Search This Blog

Friday, 6 July 2012


JHD162A LCD is a commonly available display for hobby circuits.Recently I'm trying to interface LCD to my Launch Pad and display the resistance range of a 10k pot.
         The problem is that MSP430G2231 has only 8 i/o pins.So we need to use LCD in 4 bit mode

Here is a circuit for 4 bit mode

                 In 4-bit mode the data is sent in nibbles, first we send the higher nibble and then the lower nibble. To enable the 4-bit mode of LCD, we need to follow special sequence of initialization that tells the LCD controller that user has selected 4-bit mode of operation. We call this special sequence as resetting the LCD. Following is the reset sequence of LCD.

  1. Wait for about 20mS
  2. Send the first init value (0x30)
  3. Wait for about 10mS
  4. Send second init value (0x30)
  5. Wait for about 1mS
  6. Send third init value (0x30)
  7. Wait for 1mS
  8. Select bus width (0x30 - for 8-bit and 0x20 for 4-bit)
  9. Wait for 1mS
Refer this for details of 4 bit conf


         D4----P 1.4
         D5----P 1.5
         D6----P 1.6
         D7----P 1.7
         ENABLE-----P 1.1
         RS---------P 1.0
         POT ------P 1.2

For measuring the resistance range I'm uses one i/o pin as ADC .ADC10MEM register will give a value between 0-1023

code is posted on my git hub
for code click here

No comments:

Post a Comment

Blogger Widgets