Wiring is PB0 ~ 2 RS, RW, EN, PA0 ~ 7 D0 ~ D7
But the display is shown below the
Then I will be disconnected again reset the MCU LCD, again found to function after connected to the power of the LCD display, the following figure
But if keep off the LCD power supply will microcontroller reset display is still wrong, please, feel free to grant instruction!!!!!!
Below is a code, key. There is a delay function h
# include "stm32f10x. H"
H # include "is the key."
# define Set_RS GPIO_SetBits (GPIOB, GPIO_Pin_0)
# define Set_RW GPIO_SetBits (GPIOB, GPIO_Pin_1)
# define Set_EN GPIO_SetBits (GPIOB, GPIO_Pin_2)
# define CLR_RS GPIO_ResetBits (GPIOB, GPIO_Pin_0)
# define CLR_RW GPIO_ResetBits (GPIOB, GPIO_Pin_1)
# define CLR_EN GPIO_ResetBits (GPIOB, GPIO_Pin_2)
GPIO_InitTypeDef GPIO_InitStructure;
Unsigned char table []="abcdefghijklmnop";
Void Send_Com (unsigned char Send_Com)
{
CLR_RS;
GPIO_Write (GPIOA, under-16 Send_Com);
Delay_ms (5);
Set_EN;
Delay_ms (5);
CLR_EN;
}
Void Send_Dat (unsigned char Send_Dat)
{
Set_RS;
GPIO_Write (GPIOA, Send_Dat);
Delay_ms (5);
Set_EN;
Delay_ms (5);
CLR_EN;
}
Void init ()
{
CLR_EN;
X38 Send_Com (0);
X0c Send_Com (0);
Send_Com x06 (0);
Send_Com (0 x01);
}
Void GPIO_Configuration (void)
{
GPIO_InitStructure. GPIO_Pin=GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2;
GPIO_InitStructure. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructure. GPIO_Mode=GPIO_Mode_Out_PP;
RCC_APB2PeriphClockCmd (RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE);
GPIO_Init (GPIOB, & amp; GPIO_InitStructure);
GPIO_InitStructure. GPIO_Pin=GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructure. GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init (GPIOA, & amp; GPIO_InitStructure);
}
Int main (void)
{
Unsigned char num.
GPIO_Configuration ();
init();
Send_Com (0 x80);
For (num=0; Num<=15; Num++)
{
Send_Dat (table (num));
Delay_ms (1);
}
While (1);
}
CodePudding user response:
A very common problem is the MCU reset speed over 1602, 1602 abnormal.STM32 after start-up delay in operating 1602 look at in a minute
CodePudding user response: