|
一,打开文件(可以随文下载放置在文档中打开)。(如下图1所示)
图1
二,调整原理图大小,适合可视,另存工程文件。(如下图2,3,4所示)
图2
图3
图4
三,点击Source Code标签。(如下图5所示)
图5
四,编辑main.c 代码如Proteus8.9 VSM Studio Keil编译器仿真STM32F103R6系列011_lcd1602并口(如下图6所示)
图6
五,Main.c 代码: - #include "delay.h"
- #include "usart.h"
- #include "led.h"
- #include "lcd1602.h"
- int main(void)
- {
- u16 l;
- RCC_ClocksTypeDef RCC_Clocks; //初始化程序
- RCC_Configuration(); //时钟设置
- RCC_GetClocksFreq(&RCC_Clocks);
- USART1_Init(57600); //串口初始化(参数是波特率)
- LED_Init(); //初始化LED端口 if(USART_RX_STA&0x8000)
- GPIOSt_Init();
- GPIOB->ODR= (0xff<<8);
- lcd_init();
- for(l=0; l<5000; l++) delay_ms(1);
- LED0=1;
- printf("LED0灯亮!\r\n");
- LED1=0;
- printf("LED1灯灭!\r\n");
- while(1)
- {
- LClear();
- for(l=0; l<5000; l++) delay_ms(1);
- ShowStr(1, 0, "Kaillen Work", 12);
- ShowStr(2, 1, "Wellcom YOU!", 12);
- for(l=0; l<50000; l++) delay_ms(1);
- LED0=~LED0;
- printf("LED0转换!\r\n");
- for(l=0; l<50000; l++) delay_ms(1);
- LED1=~LED1;
- printf("LED1转换!\r\n");
- LClear();
- for(l=0; l<5000; l++) delay_ms(1);
- ShowStr(1, 0, "Code Made", 9);
- ShowStr(2, 1, "---Ziegler Yin", 14);
- for(l=0; l<50000; l++) delay_ms(1);
- }
- }
复制代码 Lcd1602.h: - #ifndef _LCD1602_H_
- #define _LCD1602_H_
- #include "delay.h"
- void GPIOSt_Init(void);
- void delay(int z);
- void WaitReady(void);
- void write_com(u8 com);
- void write_data(u8 dat );
- void SetCursor(u8 x, u8 y);
- void ShowStr(u8 x, u8 y, char *str, u8 len);
- void ShowChar(u8 x, u8 y, char str);
- void lcd_init(void);
- void LClear(void);
- #endif
复制代码
六,点击构建工程按钮,编译工程。(如下图7所示)
图7
七,点击窗口左下方仿真按钮,可见lcd1602和虚拟串口的信息显示在屏。 (如下图8,9,10所示)
图8
图9
图10
八,选择release,点击构建工程按钮,编译工程生成Hex文件。(如下图11所示)
图11
附件在已安装Proteus8.9的计算机文件夹中打开即可
Keil_STM32F103RT6_011_lcd1602并口仿真文件.rar
(827.52 KB, 下载次数: 0, 售价: 1 金币)
|
|