标题: Proteus仿真stm32f1串口发送程序 [打印本页]

作者: zhangzehong    时间: 2020-7-1 09:20
标题: Proteus仿真stm32f1串口发送程序
学习protues串口发送,写下的仿真还有代码。有兴趣的师兄可以一起学习一下。仿真还有代码在压缩包里面

仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)


单片机源程序如下:
  1. #include "stm32f10x.h"
  2. #include "stm32f10x_it.h"
  3. #include "led.h"
  4. #include "modbus.h"
  5. #include "delay.h"

  6. void SystemTick_Configuration( void );

  7. int main(void)
  8. {       
  9.                 RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);        //设置系统时钟HSI作为时钟源,用protues仿真串口发送接收时必须加上
  10.                 delay_init();
  11.                 LED_Init();
  12.                 RS485_Init();
  13.                 Timer1_Init();
  14.     while (1)
  15.     {
  16.                                 USART_SendData(USART2,0x55);
  17. //                         u8 res;
  18. //       res=USART_ReceiveData(USART2); //读接收到的字节,同时相关标志自动清除
  19. //                         USART_SendData(USART2,res);
  20. //                                        RS485_Service();
  21.                 }
  22. }
复制代码

所有资料51hei提供下载:
仿真 - 串口发送.7z (265.46 KB, 下载次数: 60)







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1