找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 15381|回复: 5
收起左侧

RS-485单片机通讯模块原理图PCB工程及源码等全套资料下载

[复制链接]
ID:284341 发表于 2018-2-24 01:05 | 显示全部楼层 |阅读模式
Altium Designer画的RS-485单片机通讯模块的电路原理图和PCB图如下:(51hei附件中可下载工程文件)
0.png 0.png 0.png

MCU.jpg MCU与MCURS485.jpg MCU与RS485-232.jpg 串口设备与485.jpg ALIM0022.jpg
【简要说明】
一、尺寸:全长36mm宽22mm高18mm
二、主芯片:MAX485通讯芯片
三、工作电压:直流5V
四、特点:
1、电路简单实用,接线简单。
2、一端与485模块连接,另一端可直接和单片机连接。
3、可以单片机与单片机通讯。
4、可UART 与485设备通讯。
5、电路小巧,方便固定安装。
6、通信距离最大1200米。
7、工作温度-20°~50°。
8、RS-485的数据最高传输速率为10Mbps
9、RS-485最大的通信距离约为1200m,最大传输速率为10Mb/S,传输速率与传输距离成反比,在100Kb/S的传输速率下,才可以达到最大的通信距离,如果需传输更长的距离,需要加485中继器。RS-485总线一般最大支持32个节点,如果使用特制的485芯片,可以达到128个或者256个节点,最大的可以支持到400个节点。

测试程序 - 按复位按键上数据单片机源程序如下:
  1. /********************************************************************
  2.                             汇诚科技
  3. 实现功能:RS-485单片机通讯模块_测试程序自动返回
  4. 使用芯片:AT89S52
  5. 晶振:11.0592MHZ
  6. 波特率:9600
  7. 编译环境:Keil
  8. 作者:zhangxinchun
  9. 【声明】此程序仅用于学习与参考,引用请注明版权和作者信息!     
  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.                               结束
  104. *********************************************************************/
复制代码

所有资料51hei提供下载:
0.png
0.png

RS-485单片机通讯模块.rar

7.66 MB, 下载次数: 142, 下载积分: 黑币 -5

RS-485单片机通讯模块DXP资料.rar

60.25 KB, 下载次数: 113, 下载积分: 黑币 -5

RS-485单片机通讯模块产品使用手册.doc

8.21 MB, 下载次数: 60, 下载积分: 黑币 -5

RS-485单片机通讯模块产品使用手册.pdf

804.6 KB, 下载次数: 69, 下载积分: 黑币 -5

RS-485单片机通讯模块原理图.doc

13.5 KB, 下载次数: 72, 下载积分: 黑币 -5

测试程序 - 按复位按键上数据.rar

24.29 KB, 下载次数: 62, 下载积分: 黑币 -5

测试程序.rar

18.14 KB, 下载次数: 80, 下载积分: 黑币 -5

回复

使用道具 举报

ID:557742 发表于 2019-6-16 17:42 | 显示全部楼层
感谢lz
回复

使用道具 举报

ID:420321 发表于 2019-6-26 16:43 | 显示全部楼层
楼主你的R1是多大啊?
回复

使用道具 举报

ID:420321 发表于 2019-6-26 16:44 | 显示全部楼层
是120欧还是120k?
回复

使用道具 举报

ID:140181 发表于 2021-6-17 14:54 | 显示全部楼层

欧 120 240
回复

使用道具 举报

ID:140181 发表于 2021-6-17 14:55 | 显示全部楼层

欧,120或240
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表