This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LCD 4-bit mode Data and Control on Same Port

I have a Keil C code for using 16x2 LCD in 4-bit mode. the code is working fine.........

Problem: If "RS", "E" control pins (on LCD) are on a different port than the Data port, the code works fine.......
But if the Data and Control Pins are on the Same Port, there's nothing appearing on the LCD.

please suggest any reason (and remedy if possible) for this.........

Controller: P89V51RD2 80c51 core 8-bit CPU with 64KB Flash, 1Kb RAM from NXP(Philips).
LCD Module: Hitachi HD44780 controller based 16x2 Alphanumeric Green Backlit LCD.

Parents
  • Since you did not give use the pinout lets look at 1 function WITH the pre and \pre tags

    void lcd_data (unsigned char dat)
    {
       lcd_port = (((dat >> 4) & 0x0F)|LCD_EN|LCD_RS); // Write High Nibble
       lcd_port = (((dat >> 4) & 0x0F)|LCD_RS);
    
       lcd_port = ((dat & 0x0F)|LCD_EN|LCD_RS);       // Write Low Nibble
       lcd_port = ((dat & 0x0F)|LCD_RS);
    
       delayus(200);                                  // wait 400 uSec
       delayus(200);
    }
    
     I ASSUME  the data is the lower nibble
    
    
    

Reply
  • Since you did not give use the pinout lets look at 1 function WITH the pre and \pre tags

    void lcd_data (unsigned char dat)
    {
       lcd_port = (((dat >> 4) & 0x0F)|LCD_EN|LCD_RS); // Write High Nibble
       lcd_port = (((dat >> 4) & 0x0F)|LCD_RS);
    
       lcd_port = ((dat & 0x0F)|LCD_EN|LCD_RS);       // Write Low Nibble
       lcd_port = ((dat & 0x0F)|LCD_RS);
    
       delayus(200);                                  // wait 400 uSec
       delayus(200);
    }
    
     I ASSUME  the data is the lower nibble
    
    
    

Children
No data