找回密码
 注册

QQ登录

只需一步,快速开始

搜索

Proteus仿真STM32F407ZGT6单线模式控制lcd1602液晶屏

[复制链接]
路漫漫 发表于 2020-5-23 01:37:46 | 显示全部楼层 |阅读模式
一,打开文件(可以随文下载放置在文档中打开)。(如下图1所示)
204026pin6xosoy6y9hskt.png
图1

二,调整原理图大小,适合可视,另存工程文件。(如下图2,3,4所示)
204026b2o1coxchvd2oo2h.png
图2

204027wo5kcc5sw66l5xd0.png
图3

204027nvf9yvegs5zqyeuy.png
图4

三,点击Source Code标签。(如下图5所示)
204027tzn1pzjuqtnjy9uj.png
图5

四,编辑main.c 代码如Proteus8.9 VSM Studio GCCl编译器仿真STM32F407ZGT6系列012_lcd1602一线屏(如下图6所示)
204028w263xku23idk03f5.png
图6

五,Main.c 代码:
  1. //* Main.c file generated by New Project wizard
  2. * Processor: STM32F407ZGT6ZGT6
  3. * Compiler:  GCC for ARM
  4. */

  5. #include "mfuncs.h"
  6. #include "delay.h"
  7. #include "usart.h"
  8. #include "comds.h"

  9. u8 l;

  10. int main(void)
  11. {
  12.         delay_init(84);  //初始化延时函数
  13.         NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置系统中断优先级分组2
  14.         uart_init(9600);//初始化串口波特率为115200
  15.       
  16.                
  17.    while(1) //实现比较值从0-300递增,到300后从300-0递减,循环
  18.         {
  19.                
  20.                 init();
  21.                 uprint(" Kaillen WorkWork\r\n");
  22.                 wrt_lin(1);
  23.                 uprint(" Wellcom YOU!\r\n");
  24.                  for(l=0; l<255; l++) delay_ms(15);

  25.                 init();
  26.                 uprint(" Code Made\r\n");
  27.                 wrt_lin(1);
  28.                 uprint("  ---Ziegler Yin\r\n");
  29.                  for(l=0; l<100; l++) delay_ms(15);
  30.         }
  31. }

  32. stm32f4xx_conf.h:

  33. /**
  34.   ******************************************************************************
  35.   * @file    Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_conf.h  
  36.   * @author  MCD Application Team
  37.   * @version V1.8.0
  38.   * @date    04-November-2016
  39.   * @brief   Library configuration file.
  40.   ******************************************************************************
  41.   * @attention
  42.   *
  43.   * <h2><center>&#169; COPYRIGHT 2016 STMicroelectronics</center></h2>
  44.   *
  45.   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  46.   * You may not use this file except in compliance with the License.
  47.   * You may obtain a copy of the License at:
  48.   *
  49.   *        http://www.st.com/software_license_agreement_liberty_v2
  50.   *
  51.   * Unless required by applicable law or agreed to in writing, software
  52.   * distributed under the License is distributed on an "AS IS" BASIS,
  53.   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  54.   * See the License for the specific language governing permissions and
  55.   * limitations under the License.
  56.   *
  57.   ******************************************************************************
  58.   */

  59. /* Define to prevent recursive inclusion -------------------------------------*/
  60. #ifndef __STM32F4xx_CONF_H
  61. #define __STM32F4xx_CONF_H

  62. /* Includes ------------------------------------------------------------------*/
  63. /* Uncomment the line below to enable peripheral header file inclusion */

  64. //#include "stm32f4xx_adc.h"
  65. //#include "stm32f4xx_crc.h"
  66. #include "stm32f4xx_dbgmcu.h"
  67. //#include "stm32f4xx_dma.h"
  68. #include "stm32f4xx_exti.h"
  69. //#include "stm32f4xx_flash.h"
  70. #include "stm32f4xx_gpio.h"
  71. //#include "stm32f4xx_i2c.h"
  72. //#include "stm32f4xx_iwdg.h"
  73. #include "stm32f4xx_pwr.h"
  74. #include "stm32f4xx_rcc.h"
  75. //#include "stm32f4xx_rtc.h"
  76. //#include "stm32f4xx_sdio.h"
  77. //#include "stm32f4xx_spi.h"
  78. #include "stm32f4xx_syscfg.h"
  79. #include "stm32f4xx_tim.h"
  80. #include "stm32f4xx_usart.h"
  81. //#include "stm32f4xx_wwdg.h"
  82. #include "misc.h"
  83. /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */



  84. #if defined(STM32F40_41xxx)
  85. //#include "stm32f4xx_cryp.h"
  86. //#include "stm32f4xx_hash.h"
  87. //#include "stm32f4xx_rng.h"
  88. //#include "stm32f4xx_can.h"
  89. #include "stm32f4xx_dac.h"
  90. //#include "stm32f4xx_dcmi.h"
  91. //#include "stm32f4xx_fsmc.h"
  92. #endif /* STM32F40_41xxx */




  93. /* Exported types ------------------------------------------------------------*/
  94. /* Exported constants --------------------------------------------------------*/

  95. /* If an external clock source is used, then the value of the following define
  96.    should be set to the value of the external clock source, else, if no external
  97.    clock is used, keep this define commented */
  98. /*#define I2S_EXTERNAL_CLOCK_VAL   12288000 */ /* Value of the external clock in Hz */


  99. /* Uncomment the line below to expanse the "assert_param" macro in the
  100.    Standard Peripheral Library drivers code */
  101. /* #define USE_FULL_ASSERT    1 */

  102. /* Exported macro ------------------------------------------------------------*/
  103. #ifdef  USE_FULL_ASSERT

  104. /**
  105.   * @brief  The assert_param macro is used for function's parameters check.
  106.   * @param  expr: If expr is false, it calls assert_failed function
  107.   *   which reports the name of the source file and the source
  108.   *   line number of the call that failed.
  109.   *   If expr is true, it returns no value.
  110.   * @retval None
  111.   */
  112.   #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
  113. /* Exported functions ------------------------------------------------------- */
  114.   void assert_failed(uint8_t* file, uint32_t line);
  115. #else
  116.   #define assert_param(expr) ((void)0)
  117. #endif /* USE_FULL_ASSERT */

  118. #endif /* __STM32F4xx_CONF_H */

  119. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

复制代码

六,点击构建工程按钮,编译工程。(如下图7所示)
204028an9x0fyow06uya09.png
图7

七,点击窗口左下方仿真按钮,可见lcd1602一线屏和虚拟串口的信息显示在屏。 (如下图8,9,10所示)
204028rk5xtn8rggrgt6gn.png
图8

204029dgppxn6ptu6ddu9f.png
图9
204029o33jddlidji33odf.png
图10


八,选择release,点击构建工程按钮,编译工程生成Hex文件。(如下图11所示)
204030g3u2729h7h3uehf2.png
图11

附件在已安装Proteus8.9的计算机文件夹中打开即可
LCD1602单线屏.rar (364.41 KB, 售价: 1 E币)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|ELEOK |网站地图

GMT+8, 2024-11-21 19:19

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表