工控论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 15|回复: 0

Proteus仿真STM32F407ZGT6单线控制lcd2004液晶屏

[复制链接]

96

主题

97

帖子

21

积分

初级会员

Rank: 2

工控币
21
发表于 5 天前 | 显示全部楼层 |阅读模式
一,打开文件(可以随文下载放置在文档中打开)。(如下图1所示)图1二,调整原理图大小,适合可视,另存工程文件。(如下图2,3,4所示) 105145qz5mw8zzom5fewzz.png 图2 105145pq0qosy57u0cyuuy.png 图3 105145z1nlrbmblmzb7mr4.png 图4三,点击Source Code标签。(如下图5所示) 105146gz3y35v3szqq3lcp.png 图5四,编辑main.c 代码如Proteus8.9 VSM Studio GCC编译器仿真STM32F407ZGT6系列015_lcd2004一线屏(如下图6所示) 105147nqi1akxcuv5vwszz.png 图6五,Main.c 代码:
  1. /* Main.c file generated by New Project wizard
  2. * Author:   Ziegler Yin
  3. * Created:   周四 一月 16 2020
  4. * Processor: STM32F407ZGT6ZGT6
  5. * Compiler:  GCC for ARM
  6. */

  7. #include "mfuncs.h"
  8. #include "delay.h"
  9. #include "usart.h"
  10. #include "comds.h"

  11. u8 l;

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

  35. stm32f4xx_conf.h:

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

  62. /* Define to prevent recursive inclusion -------------------------------------*/
  63. #ifndef __STM32F4xx_CONF_H
  64. #define __STM32F4xx_CONF_H

  65. /* Includes ------------------------------------------------------------------*/
  66. /* Uncomment the line below to enable peripheral header file inclusion */

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



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




  96. /* Exported types ------------------------------------------------------------*/
  97. /* Exported constants --------------------------------------------------------*/

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


  102. /* Uncomment the line below to expanse the "assert_param" macro in the
  103.    Standard Peripheral Library drivers code */
  104. /* #define USE_FULL_ASSERT    1 */

  105. /* Exported macro ------------------------------------------------------------*/
  106. #ifdef  USE_FULL_ASSERT

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

  121. #endif /* __STM32F4xx_CONF_H */

  122. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
复制代码

六,点击构建工程按钮,编译工程。(如下图7所示) 105147f75it5522iytrq4t.png 图7七,点击窗口左下方仿真按钮,可见lcd2004一线屏和虚拟串口的信息显示在屏。 (如下图8,9,10所示) 105147zymtiism1rkt681i.png 图8 105147yn8zz2nizuw2drsr.png 图9 105148zrbho4mol9b1llb9.png 图10八,选择release,点击构建工程按钮,编译工程生成Hex文件。(如下图11所示) 105148lfd2o27b3l2hz37n.png 图11
附件在已安装Proteus8.9的计算机文件夹中打开即可
stm32_LCD2004单线仿真文件.rar  [预览压缩包] (346.53 KB, 售价: 1 工控币)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

免责声明: 工控技术网(www.eleok.com)所有内容均为网友自行发布,不代表网站立场。如有版权纠纷,请联系本站删除:1370723259@qq.com

QQ|小黑屋|手机版|工控技术网 |网站地图

GMT+8, 2020-5-28 16:33

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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