標(biāo)題: 單片機(jī)RS485-PC串口通信Proteus仿真+程序 [打印本頁(yè)]

作者: 123456xxyr    時(shí)間: 2022-4-16 21:58
標(biāo)題: 單片機(jī)RS485-PC串口通信Proteus仿真+程序
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)



單片機(jī)源程序如下:
  1. #include <reg51.h>
  2. #include <intrins.h>
  3. #define uchar unsigned char
  4. #define uint unsigned int
  5. sbit P12=P1^2;
  6. char code str[] = "you are the best! \n\r";

  7. main()
  8. {
  9. uint j;
  10. TMOD=0x20;
  11. TL1=0xfd;TH1=0xfd;
  12. SCON=0x50;
  13. PCON &= 0xef;
  14. TR1=1;
  15. IE=0x00;
  16. P12=1;
  17. while(1)
  18. {

  19. uchar i=0;
  20. while(str[i]!='\0')
  21. {
  22. SBUF=str[i];
  23. while(!TI);
  24. TI=0;
  25. i++;
  26. }

  27. for(j=0;j<50000;j++);
  28. }
  29. }
復(fù)制代碼

Keil代碼與Proteus仿真下載:
仿真程序.7z (370.86 KB, 下載次數(shù): 87)


作者: 雪玉寐影    時(shí)間: 2022-5-25 12:42
這個(gè)簡(jiǎn)潔明了,ASCII發(fā)送沒(méi)問(wèn)題!




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