STM32單片機(jī)學(xué)習(xí)(9) LCD1602顯示屏輸出實(shí)驗(yàn)
注:使用普中科技開發(fā)板測(cè)試時(shí),需要拔掉Boot1插口 接5V電壓,重啟
本文引用地址:http://m.butianyuan.cn/article/201611/318258.htm/** * 軟件功能: LCD1602實(shí)驗(yàn)(軟件延時(shí)方式)* */#include "stm32f10x.h"#include "delay.h"#include/*定義宏變量lcd_RS = data/command(H/L) 數(shù)據(jù)/命令操作lcd_RW = read/write(H/L) 讀寫操作lcd_Enable 使能操作lcd_GPIO lcd1602接在了GPIOX口*///接口#define lcd_GPIO GPIOB#define lcd_busyflag GPIO_Pin_15 //DB7對(duì)應(yīng)的口#define lcd_pin_RS GPIO_Pin_1 #define lcd_pin_RW GPIO_Pin_2#define lcd_pin_Enable GPIO_Pin_0//狀態(tài)#define lcd_DATA 1#define lcd_COMMAND 0#define lcd_READ 1#define lcd_WRITE 0//功能#define lcd_RS(n) n ? GPIO_SetBits(lcd_GPIO,lcd_pin_RS) : GPIO_ResetBits(lcd_GPIO,lcd_pin_RS)#define lcd_RW(n) n ? GPIO_SetBits(lcd_GPIO,lcd_pin_RW) : GPIO_ResetBits(lcd_GPIO,lcd_pin_RW)#define lcd_Enable(n) n ? GPIO_SetBits(lcd_GPIO,lcd_pin_Enable) : GPIO_ResetBits(lcd_GPIO,lcd_pin_Enable)void RCC_Configuration(void);void GPIO_Configuration(void);void Lcd_Write(u8 type,u8 buf); void Lcd_WriteString(u8 *buf);int Lcd_isbusy(void);void Lcd_Init(void);int fputc(int ch, FILE *f);void getSys_ID(void);/*函數(shù): int main(void)功能: main主函數(shù)參數(shù): 無返回: 無/int main(void){int i=0;unsigned char* display_1={"chip ID:"};//unsigned char* display_2={"www.llqqww.com"};RCC_Configuration();GPIO_Configuration();delay_init(72);Lcd_Init();//while(1){while(Lcd_isbusy()); //檢測(cè)忙信號(hào)Lcd_Write(lcd_COMMAND,0x80); //第一行第一個(gè)字開始for(i=0;display_1[i]!=