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 display with a button

Hi everyone,

I'm a begginner and i'm trying to display a "DO" on my STM32L-Discovery board (STM32L152). In order to do so, I tried to connect the button to the pin PA11. Nevertheless, it doesn't work.

Here is my code :


int main(void)


  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();


  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_LCD_Init();
  MX_DAC_Init();

  /* USER CODE BEGIN 2 */

    BSP_LCD_GLASS_Init();
    BSP_LCD_GLASS_BarLevelConfig(0);
    BSP_LCD_GLASS_Clear();

   // PA11 as digital input(00)

    GPIOA->PUPDR &= ~(1 << (11*2 +1));
    GPIOA->PUPDR  |= (1 << (11*2));

  /* USER CODE END 2 */

  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

if ((GPIOA->IDR&(0X0000000B)==0)) {

            while ((GPIOA->IDR&0X0000000B)==0) {                 BSP_LCD_GLASS_DisplayString((uint8_t *)"DO");
                wait(70000);
            }
            BSP_LCD_GLASS_Clear();
        }



    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}
<\pre>

Does anyone have a idea to solve this problem ?

Thanks in advance :)