void write_com(u8 com) { u16 para; RS_1602_L(); RW_1602_L(); para = (u16)GPIOB->IDR; para = 0x00FF¶ GPIOB->ODR=( (u16) ((com) )<<8)|para; delay_ms(1); EN_1602_H(); delay_ms(1); EN_1602_L(); } void write_dat(u8 dat) { u16 para; RS_1602_H(); RW_1602_L(); para = (u16)GPIOB->IDR; para = 0x00FF¶ GPIOB->ODR=( (u16) ((dat) )<<8)|para; delay_ms(1); EN_1602_H(); delay_ms(1); EN_1602_L(); } void LCD1602_Char(u8 addr,u8 LCD1602_Table[]) { u8 length,i; length = strlen(LCD1602_Table); write_com(addr); for(i=0;i<length;i++) { write_dat(LCD1602_Table[i]); delay_ms(10); } } /************************************************************************* void init_1602(void) { // LCD1602_GPIO_Function(); // LCD1602_GPIO_Data(); write_com(0x38); delay_ms(5); write_com(0x0c); delay_ms(5); write_com(0x06); delay_ms(5); write_com(0x01); delay_ms(5); } |
共4条
1/1 1 跳转至页
stm32L053驱动 1602显示屏代码

只看楼主 1楼
共4条
1/1 1 跳转至页