標(biāo)題: RS-485單片機(jī)通訊模塊原理圖PCB工程及源碼等全套資料下載 [打印本頁(yè)]

作者: 電子愛(ài)好者999    時(shí)間: 2018-2-24 01:05
標(biāo)題: RS-485單片機(jī)通訊模塊原理圖PCB工程及源碼等全套資料下載
Altium Designer畫(huà)的RS-485單片機(jī)通訊模塊的電路原理圖和PCB圖如下:(51hei附件中可下載工程文件)



【簡(jiǎn)要說(shuō)明】
一、尺寸:全長(zhǎng)36mm寬22mm高18mm
二、主芯片:MAX485通訊芯片
三、工作電壓:直流5V
四、特點(diǎn):
1、電路簡(jiǎn)單實(shí)用,接線簡(jiǎn)單。
2、一端與485模塊連接,另一端可直接和單片機(jī)連接。
3、可以單片機(jī)與單片機(jī)通訊。
4、可UART 與485設(shè)備通訊。
5、電路小巧,方便固定安裝。
6、通信距離最大1200米。
7、工作溫度-20°~50°。
8、RS-485的數(shù)據(jù)最高傳輸速率為10Mbps
9、RS-485最大的通信距離約為1200m,最大傳輸速率為10Mb/S,傳輸速率與傳輸距離成反比,在100Kb/S的傳輸速率下,才可以達(dá)到最大的通信距離,如果需傳輸更長(zhǎng)的距離,需要加485中繼器。RS-485總線一般最大支持32個(gè)節(jié)點(diǎn),如果使用特制的485芯片,可以達(dá)到128個(gè)或者256個(gè)節(jié)點(diǎn),最大的可以支持到400個(gè)節(jié)點(diǎn)。

測(cè)試程序 - 按復(fù)位按鍵上數(shù)據(jù)單片機(jī)源程序如下:
  1. /********************************************************************
  2.                             匯誠(chéng)科技
  3. 實(shí)現(xiàn)功能:RS-485單片機(jī)通訊模塊_測(cè)試程序自動(dòng)返回
  4. 使用芯片:AT89S52
  5. 晶振:11.0592MHZ
  6. 波特率:9600
  7. 編譯環(huán)境:Keil
  8. 作者:zhangxinchun
  9. 【聲明】此程序僅用于學(xué)習(xí)與參考,引用請(qǐng)注明版權(quán)和作者信息!     
  10. /*********************************************************************/
  11. #include "reg51.h"
  12. #include "intrins.h"

  13. typedef unsigned char BYTE;
  14. typedef unsigned int WORD;

  15. #define FOSC 11059200L      //System frequency
  16. #define BAUD 9600           //UART baudrate

  17. /*Define UART parity mode*/
  18. #define NONE_PARITY     0   //None parity
  19. #define ODD_PARITY      1   //Odd parity
  20. #define EVEN_PARITY     2   //Even parity
  21. #define MARK_PARITY     3   //Mark parity
  22. #define SPACE_PARITY    4   //Space parity

  23. #define PARITYBIT EVEN_PARITY   //Testing even parity

  24. sbit bit9 = P2^2;           //P2.2 show UART data bit9
  25. bit busy;

  26. void SendData(BYTE dat);
  27. void SendString(char *s);

  28. void main()
  29. {
  30. #if (PARITYBIT == NONE_PARITY)
  31.     SCON = 0x50;            //8-bit variable UART
  32. #elif (PARITYBIT == ODD_PARITY) || (PARITYBIT == EVEN_PARITY) || (PARITYBIT == MARK_PARITY)
  33.     SCON = 0xda;            //9-bit variable UART, parity bit initial to 1
  34. #elif (PARITYBIT == SPACE_PARITY)
  35.     SCON = 0xd2;            //9-bit variable UART, parity bit initial to 0
  36. #endif

  37.     TMOD = 0x20;            //Set Timer1 as 8-bit auto reload mode
  38.     TH1 = TL1 = -(FOSC/12/32/BAUD); //Set auto-reload vaule
  39.     TR1 = 1;                //Timer1 start run
  40.     ES = 1;                 //Enable UART interrupt
  41.     EA = 1;                 //Open master interrupt switch

  42.     SendString("AT89S52 11.0592MHZ 9600 ");
  43.     while(1);
  44. }

  45. /*----------------------------
  46. UART interrupt service routine
  47. ----------------------------*/
  48. void Uart_Isr() interrupt 4 using 1
  49. {
  50.     if (RI)
  51.     {
  52.         RI = 0;             //Clear receive interrupt flag
  53.         P0 = SBUF;          //P0 show UART data
  54.         bit9 = RB8;         //P2.2 show parity bit
  55.     }
  56.     if (TI)
  57.     {
  58.         TI = 0;             //Clear transmit interrupt flag
  59.         busy = 0;           //Clear transmit busy flag
  60.     }
  61. }

  62. /*----------------------------
  63. Send a byte data to UART
  64. Input: dat (data to be sent)
  65. Output:None
  66. ----------------------------*/
  67. void SendData(BYTE dat)
  68. {
  69.     while (busy);           //Wait for the completion of the previous data is sent
  70.     ACC = dat;              //Calculate the even parity bit P (PSW.0)
  71.     if (P)                  //Set the parity bit according to P
  72.     {
  73. #if (PARITYBIT == ODD_PARITY)
  74.         TB8 = 0;            //Set parity bit to 0
  75. #elif (PARITYBIT == EVEN_PARITY)
  76.         TB8 = 1;            //Set parity bit to 1
  77. #endif
  78.     }
  79.     else
  80.     {
  81. #if (PARITYBIT == ODD_PARITY)
  82.         TB8 = 1;            //Set parity bit to 1
  83. #elif (PARITYBIT == EVEN_PARITY)
  84.         TB8 = 0;            //Set parity bit to 0
  85. #endif
  86.     }
  87.     busy = 1;
  88.     SBUF = ACC;             //Send data to UART buffer
  89. }

  90. /*----------------------------
  91. Send a string to UART
  92. Input: s (address of string)
  93. Output:None
  94. ----------------------------*/
  95. void SendString(char *s)
  96. {
  97.     while (*s)              //Check the end of the string
  98.     {
  99.         SendData(*s++);     //Send current char and increment string ptr
  100.     }
  101. }


  102. /********************************************************************
  103.                               結(jié)束
  104. *********************************************************************/
復(fù)制代碼

所有資料51hei提供下載:

0.png (12.17 KB, 下載次數(shù): 63)

0.png

0.png (9.11 KB, 下載次數(shù): 55)

0.png

RS-485單片機(jī)通訊模塊.rar

7.66 MB, 下載次數(shù): 144, 下載積分: 黑幣 -5

RS-485單片機(jī)通訊模塊DXP資料.rar

60.25 KB, 下載次數(shù): 117, 下載積分: 黑幣 -5

RS-485單片機(jī)通訊模塊產(chǎn)品使用手冊(cè).doc

8.21 MB, 下載次數(shù): 62, 下載積分: 黑幣 -5

RS-485單片機(jī)通訊模塊產(chǎn)品使用手冊(cè).pdf

804.6 KB, 下載次數(shù): 71, 下載積分: 黑幣 -5

RS-485單片機(jī)通訊模塊原理圖.doc

13.5 KB, 下載次數(shù): 74, 下載積分: 黑幣 -5

測(cè)試程序 - 按復(fù)位按鍵上數(shù)據(jù).rar

24.29 KB, 下載次數(shù): 65, 下載積分: 黑幣 -5

測(cè)試程序.rar

18.14 KB, 下載次數(shù): 83, 下載積分: 黑幣 -5


作者: yyy22222    時(shí)間: 2019-6-16 17:42
感謝lz
作者: Mr_Dai    時(shí)間: 2019-6-26 16:43
樓主你的R1是多大啊?

作者: Mr_Dai    時(shí)間: 2019-6-26 16:44
是120歐還是120k?
作者: wy000129    時(shí)間: 2021-6-17 14:54
Mr_Dai 發(fā)表于 2019-6-26 16:44
是120歐還是120k?

歐 120 240
作者: wy000129    時(shí)間: 2021-6-17 14:55
Mr_Dai 發(fā)表于 2019-6-26 16:44
是120歐還是120k?

歐,120或240




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