国产免费AV|泡泡玛特欧洲总部将设在伦敦|中文天堂网www新版资源在线|一本久道综合在线中文|国精产品一二三产区的使用方法|香蕉鱼在线观看|www.27eee

ELEOK

標題: Proteus仿真STM32F407ZGT6單線模式控制lcd1602液晶屏 [打印本頁]

作者: 路漫漫    時間: 2020-5-23 01:37
標題: Proteus仿真STM32F407ZGT6單線模式控制lcd1602液晶屏
一,打開文件(可以隨文下載放置在文檔中打開)。(如下圖1所示)

圖1

二,調整原理圖大小,適合可視,另存工程文件。(如下圖2,3,4所示)

圖2


圖3


圖4

三,點擊Source Code標簽。(如下圖5所示)

圖5

四,編輯main.c 代碼如Proteus8.9 VSM Studio GCCl編譯器仿真STM32F407ZGT6系列012_lcd1602一線屏(如下圖6所示)

圖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);  //初始化延時函數(shù)
  13.         NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//設置系統(tǒng)中斷優(yōu)先級分組2
  14.         uart_init(9600);//初始化串口波特率為115200
  15.       
  16.                
  17.    while(1) //實現(xiàn)比較值從0-300遞增,到300后從300-0遞減,循環(huán)
  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所示)

圖7

七,點擊窗口左下方仿真按鈕,可見lcd1602一線屏和虛擬串口的信息顯示在屏。 (如下圖8,9,10所示)

圖8


圖9

圖10


八,選擇release,點擊構建工程按鈕,編譯工程生成Hex文件。(如下圖11所示)

圖11

附件在已安裝Proteus8.9的計算機文件夾中打開即可
LCD1602單線屏.rar (364.41 KB, 售價: 1 E幣)





歡迎光臨 ELEOK (http://m.afoofa.cn/) Powered by Discuz! X5.0