2022-05-07 02:35 AM
Hi,
I am using stm32f103 and IAR for codes.
I am trying to use a character LCD 16x2 for my project. It turns on with 5 volt that I connect but not showing any character. I changed the potentiometer and still no sign of characters.
I was wondering what the problem is?
Here is the main code
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
lcd_init();
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
lcd_gotoxy(0,0);
lcd_puts("10");
HAL_Delay(10);
HAL_GPIO_WritePin(GPIOC, LED_STM_ON_Pin, GPIO_PIN_SET);
HAL_Delay(100);
HAL_GPIO_WritePin(GPIOC, LED_STM_ON_Pin, GPIO_PIN_RESET);
}
/* USER CODE END 3 */
}
I attached the library that I used and a picture of CubeMX.
I would appreciate any help.
Ali/
#[LCD/LTDC] #[STM32 MCUs] #STM32F1
2022-05-07 03:29 AM
Try initializing the LCD *after* you have initialized the GPIO, etc
2022-05-07 03:38 AM
Nothing happened. Still the same.
2022-05-07 03:46 AM
LCD have RW pin too , how you manage it?.
2022-05-07 04:09 AM
always 0. in board with ground.
2022-05-08 01:46 AM
If you are using well "proved" library wrong pinout is the most common mistake. Your library looks "unproven", then there can be multiple errors. First question is communication timing. Does your library comply all timing requirements for ENABLE pin pulse, hold a setup times on all signals ? From breif view at your code it look like no. Another common mistake is initialisation sequence (and its timing). Find some proven library or thoroughly read HD447800 datasheet, especially initialisation.
2022-05-08 10:07 AM
Your code is little ... Try inspire 8051 Lcd16x2 Interfacing In 4 Bit Mode With 8051 | 8051 (electronicwings.com)