標題: Proteus仿真stm32f1串口發(fā)送程序 [打印本頁]

作者: zhangzehong    時間: 2020-7-1 09:20
標題: Proteus仿真stm32f1串口發(fā)送程序
學(xué)習(xí)protues串口發(fā)送,寫下的仿真還有代碼。有興趣的師兄可以一起學(xué)習(xí)一下。仿真還有代碼在壓縮包里面

仿真原理圖如下(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);        //設(shè)置系統(tǒng)時鐘HSI作為時鐘源,用protues仿真串口發(fā)送接收時必須加上
  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); //讀接收到的字節(jié),同時相關(guān)標志自動清除
  19. //                         USART_SendData(USART2,res);
  20. //                                        RS485_Service();
  21.                 }
  22. }
復(fù)制代碼

所有資料51hei提供下載:
仿真 - 串口發(fā)送.7z (265.46 KB, 下載次數(shù): 60)







歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1