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 project at stm32

Hi, I'm new in embedded system,I've stm32f100rb and I want to display a string at an lcd named jhd162a 16x2, but when I test it, the lcd always display a black line,I test it with an empty board and it's the same problem, one black line.
anyone have an idea please???
and thank you.

Parents
  • I set the GPIO_Speed to 50 Mhz and it the same problem :/
    this is all of the code project:

    lcd_hd44780.h:

    //******************************************************************************
    //    THE SOFTWARE INCLUDED IN THIS FILE IS FOR GUIDANCE ONLY.
    //    AUTHOR SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
    //    OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
    //    FROM USE OF THIS SOFTWARE.
    //******************************************************************************
    
    //##############################################################################
    // lcd_hd44780.h
    //##############################################################################
    
    //****************************************************************************//
    #include "STM32vldiscovery.h"
    
    
    #define LCD_GPIO GPIOB
    #define LCD_CLK_LINE RCC_APB2Periph_GPIOB
    
    #define LCD_D4 GPIO_Pin_6
    #define LCD_D5 GPIO_Pin_5
    #define LCD_D6 GPIO_Pin_4
    #define LCD_D7 GPIO_Pin_3
    
    #define LCD_RS GPIO_Pin_9
    #define LCD_RW GPIO_Pin_8
    #define LCD_EN GPIO_Pin_7
    //******************************************************************************//
    
    
    #define HD44780_CLEAR                                          0x01
    
    #define HD44780_HOME                                           0x02
    
    #define HD44780_ENTRY_MODE                                 0x04
            #define HD44780_EM_SHIFT_CURSOR          0
            #define HD44780_EM_SHIFT_DISPLAY         1
            #define HD44780_EM_DECREMENT               0
            #define HD44780_EM_INCREMENT               2
    
    #define HD44780_DISPLAY_ONOFF                      0x08
            #define HD44780_DISPLAY_OFF                  0
            #define HD44780_DISPLAY_ON                         4
            #define HD44780_CURSOR_OFF                         0
            #define HD44780_CURSOR_ON                            2
            #define HD44780_CURSOR_NOBLINK     0
            #define HD44780_CURSOR_BLINK               1
    
    #define HD44780_DISPLAY_CURSOR_SHIFT 0x10
            #define HD44780_SHIFT_CURSOR               0
            #define HD44780_SHIFT_DISPLAY              8
            #define HD44780_SHIFT_LEFT                         0
            #define HD44780_SHIFT_RIGHT                  4
    
    #define HD44780_FUNCTION_SET                       0x20
            #define HD44780_FONT5x7                              0
            #define HD44780_FONT5x10                             4
            #define HD44780_ONE_LINE                             0
            #define HD44780_TWO_LINE                             8
            #define HD44780_4_BIT                                  0
            #define HD44780_8_BIT                                  16
    
    #define HD44780_CGRAM_SET                                    0x40
    
    #define HD44780_DDRAM_SET                                    0x80
    
    //##############################################################
    void lcd_init(void);
    void lcd_cls(void);
    void lcd_str(unsigned char * text);
    void lcd_strxy(unsigned char * text, unsigned char x, unsigned char y);
    void lcd_locate(unsigned char x, unsigned char y);
    void lcd_int(int n);
    void lcd_intxy(int n, unsigned char x, unsigned char y);
    
    //###############################################################
    
    void lcd_writedata(unsigned char dataToWrite);
    void lcd_writecommand(unsigned char commandToWrite);
    void lcd_writebinary(unsigned int var, unsigned char bitCount);
    void lcd_addchar (unsigned char chrNum, unsigned char n, const unsigned char *p);
    

Reply
  • I set the GPIO_Speed to 50 Mhz and it the same problem :/
    this is all of the code project:

    lcd_hd44780.h:

    //******************************************************************************
    //    THE SOFTWARE INCLUDED IN THIS FILE IS FOR GUIDANCE ONLY.
    //    AUTHOR SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
    //    OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
    //    FROM USE OF THIS SOFTWARE.
    //******************************************************************************
    
    //##############################################################################
    // lcd_hd44780.h
    //##############################################################################
    
    //****************************************************************************//
    #include "STM32vldiscovery.h"
    
    
    #define LCD_GPIO GPIOB
    #define LCD_CLK_LINE RCC_APB2Periph_GPIOB
    
    #define LCD_D4 GPIO_Pin_6
    #define LCD_D5 GPIO_Pin_5
    #define LCD_D6 GPIO_Pin_4
    #define LCD_D7 GPIO_Pin_3
    
    #define LCD_RS GPIO_Pin_9
    #define LCD_RW GPIO_Pin_8
    #define LCD_EN GPIO_Pin_7
    //******************************************************************************//
    
    
    #define HD44780_CLEAR                                          0x01
    
    #define HD44780_HOME                                           0x02
    
    #define HD44780_ENTRY_MODE                                 0x04
            #define HD44780_EM_SHIFT_CURSOR          0
            #define HD44780_EM_SHIFT_DISPLAY         1
            #define HD44780_EM_DECREMENT               0
            #define HD44780_EM_INCREMENT               2
    
    #define HD44780_DISPLAY_ONOFF                      0x08
            #define HD44780_DISPLAY_OFF                  0
            #define HD44780_DISPLAY_ON                         4
            #define HD44780_CURSOR_OFF                         0
            #define HD44780_CURSOR_ON                            2
            #define HD44780_CURSOR_NOBLINK     0
            #define HD44780_CURSOR_BLINK               1
    
    #define HD44780_DISPLAY_CURSOR_SHIFT 0x10
            #define HD44780_SHIFT_CURSOR               0
            #define HD44780_SHIFT_DISPLAY              8
            #define HD44780_SHIFT_LEFT                         0
            #define HD44780_SHIFT_RIGHT                  4
    
    #define HD44780_FUNCTION_SET                       0x20
            #define HD44780_FONT5x7                              0
            #define HD44780_FONT5x10                             4
            #define HD44780_ONE_LINE                             0
            #define HD44780_TWO_LINE                             8
            #define HD44780_4_BIT                                  0
            #define HD44780_8_BIT                                  16
    
    #define HD44780_CGRAM_SET                                    0x40
    
    #define HD44780_DDRAM_SET                                    0x80
    
    //##############################################################
    void lcd_init(void);
    void lcd_cls(void);
    void lcd_str(unsigned char * text);
    void lcd_strxy(unsigned char * text, unsigned char x, unsigned char y);
    void lcd_locate(unsigned char x, unsigned char y);
    void lcd_int(int n);
    void lcd_intxy(int n, unsigned char x, unsigned char y);
    
    //###############################################################
    
    void lcd_writedata(unsigned char dataToWrite);
    void lcd_writecommand(unsigned char commandToWrite);
    void lcd_writebinary(unsigned int var, unsigned char bitCount);
    void lcd_addchar (unsigned char chrNum, unsigned char n, const unsigned char *p);
    

Children