If you don't know how to use RS 485 to realize serial communication, you are too out of date. Here is a tutorial to help you easily replace RS 232

Publisher:恬淡岁月Latest update time:2020-10-12 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  ARM (Advanced RISC Machines) is a general term for a class of microprocessors. ARM is a well-known company in the microprocessor industry. It has designed a large number of high-performance, low-cost, low-energy RISC processors, related technologies and software. ARM microprocessor is a high-performance, low-power 32-bit microprocessor, which is widely used in embedded systems. ARM 9 represents the mainstream processor of ARM company, and has been widely used in handheld phones, set-top boxes, digital cameras, GPS, personal digital assistants and Internet devices. Here, the typical STR912FW44X6 chip in the ARM 9 series produced by ST company is used as the MCU of the hardware development platform to complete the hardware design of the data acquisition and transmission system in the ARM-based solar power generation system, and a new method of using RS 485 serial port instead of RS 232 serial 121 for communication is proposed.


  l Overall hardware design framework


  The overall hardware design framework is shown in Figure 1.

  Figure 1 Overall hardware design framework


  2 Hardware Introduction

  Now the STR912FW44X6 chip is used as the MCU of the hardware development platform. The STR912FW44X6 has expanded dot matrix LCD display, input buttons, UART interface, IrDA, CAN, USB, ETM interface, audio amplifier/microphone amplifier and Ethernet interface. Among them, this article uses the UART interface and Ethernet interface. The UART interface is divided into one RS 232 serial port and two RS 485 serial ports. The RS 232 serial port is used to connect to the RS 232 serial port of the GSM module to realize GPRS wireless transmission; two RS 485 serial ports, one is used as a MODBUS communication interface, and the other is used to connect to the electric meter to collect statistics and display the power generation of the solar power generation system. Ethernet is connected to the network through a network cable to realize wireless transmission of data.


  3 Hardware circuit design and function implementation

  3.1 Circuit design and function implementation of RS 232 serial port

  RS 232 is a serial data interface standard, and is currently the most commonly used serial interface standard for data transmission between computers and between computers and peripherals. The RS 232 serial interface bus is suitable for communication distances between devices not exceeding 15 m, and the maximum transmission rate is 20 KB/s.


  The RS 232 serial port is realized by ST3232EAR produced by ST. ST3232EAR is a chip that converts the RS 232 signal level (-10 V, +10 V) of the computer serial port into the TTL signal level (0V, +3.3 V) used by the microcontroller. Its internal structure consists of three parts: the first part is the charge pump circuit, which consists of pins 1 to 6 and 4 capacitors. Its function is to generate two power supplies of +12 V and -12 V to provide the level requirements for the RS 232 serial port. The second part is the data conversion channel, which consists of pins 7 to 14 to form two data channels. Among them, pins 13 (RlIN), 12 (R1OUT), 11 (TlIN), and 14 (T1OUT) are the first data channel; pins 8 (R2IN), 9 (R2OUT), 10 (T2IN), and 7 (T2OUT) are the second data channel. The TTL/CMOS data is converted from TlIN and T2IN to RS 232 data, and sent to the computer DP9 plug from T1OUT and T20UT; the RS 232 data of the DP9 plug is converted from RlIN and R2IN to TTL/CMOS data, and then output from R1OUT and R2OUT. The third part is the power supply, which consists of 15-pin GND and 16-pin VCC (+5 V).


  By connecting the RXD and TXD of the GPIO in the MCU to the 12th pin (R1OUT) and the 11th pin (T1IN) of the ST3232 respectively, the 14th pin (T10UT) and the 13th pin (R1IN) output RS 232 level, and then connecting the RS 232 serial port of the GSM module and the RS 232 serial port on the MCU board, the purpose of controlling the function of the GSM module can be achieved by writing AT commands to the RS 232 interface, so as to realize data transmission through GPRS.


  3.2 Circuit design and function implementation of RS 485 serial port

  RS 485 is used to collect data from solar power generation systems. The reason why RS 485 is used here instead of RS 232 is that RS 485 has many advantages over RS ​​232. RS 232 adopts unbalanced transmission mode, that is, single-ended communication, and the data signals at its transceiver are all relative to the ground signal. Therefore, its common-mode suppression ability is poor, and coupled with the distributed capacitance of the twisted pair, its maximum transmission distance is about 15 m, the maximum rate is 20 KB/s, and it can only support point-to-point communication. RS 485 uses balanced transmission and differential reception to achieve communication. Since the transmission line usually uses twisted pair and sometimes differential transmission, it has a strong ability to resist common-mode interference. The bus transceiver is very sensitive and can detect voltages as low as 200 mV, so its transmission signal can be restored over a kilometer. The maximum communication distance of RS 485 is about 1,219 m, and the maximum transmission rate is 10 MB/s. It uses dual-half-duplex working mode to support multi-point data communication, and its bus generally supports a maximum of 32 nodes.


  The RS 485 interface chip uses ADM3485. ADM3485 uses a single power supply +3.3 V to work, half-duplex communication mode, and can complete the function of converting TTL level to RS 485 level. The structure and pins of the ADM34185 chip are very simple. It contains a driver and a receiver inside. The RO and DI terminals are the output terminal of the receiver and the input terminal of the driver respectively. When connected to the microcontroller, it only needs to be connected to the RXD and TXD of the microcontroller respectively. The RE and DE terminals are the enable terminals for receiving and sending respectively. When RE is logic 0, the device is in the receiving state; when DE is logic 1, the device is in the sending state. Because ADM3485 works in half-duplex state, only one pin of the microcontroller is needed to control these two pins. The A terminal and the B terminal are the differential signal terminals for receiving and sending respectively. When the level of the A pin is higher than that of the B terminal, it means that the data sent is 1; when the level of the A pin is lower than that of the B terminal. The data sent is 0. The wiring is very simple when connected to the microcontroller. Only one signal is needed to control the receiving and sending of ADM3485. At the same time, a matching resistor is added between the A and B terminals. Generally, a 100Ω resistor can be selected. The design has two RS 485s, one of which is used as a MODBUS communication interface, and the other is used to connect the watt-hour meter to collect statistics and display the power generation of the solar power generation system.


  3.3 Ethernet circuit design and functional implementation

  The Ethernet port uses 0880-1X1T-01, and the Ethernet physical layer interface chip uses ST's STElOOP Fast Ethernet physical layer chip. The STEl00P Ethernet interface chip provides a set of media independent interfaces (MII). Media independence means that any type of PHY device can work properly without redesigning or replacing the MAC hardware. The MII interface is a standard interface between the Fast Ethernet MAC layer and the PHY layer, and is a standard for the Ethernet industry defined by IEEE 802.3. It includes a data interface and a management interface between the MAC and PHY. The data interface includes two independent channels for the transmitter and receiver respectively. Each channel has its own data, clock, and control signals. The MII data interface requires a total of 16 signals. The management interface is a dual-signal interface: one is a clock signal and the other is a data signal.


  Through the management interface, the upper layer monitors and controls PHY. Ethernet-based TCP/IP communication allows ARM to be connected to the Internet through a network cable and can communicate with a computer in real time to transmit real-time data of the solar power generation system.


  A new communication method using RS 485 serial port instead of RS 232 serial port is proposed. This method solves the limitations of RS 232 serial port in transmission distance and number of nodes, and greatly improves the data transmission capacity.

Reference address:If you don't know how to use RS 485 to realize serial communication, you are too out of date. Here is a tutorial to help you easily replace RS 232

Previous article:Using ARM and FPGA to build a neural network processor communication solution
Next article:Detailed analysis of the characteristics and differences of MCU, ARM, and FPGA embedded

Recommended ReadingLatest update time:2024-11-16 14:58

A51 mid-section and RSEG usage
RSEG is a segment selection instruction. To understand its meaning, you need to understand the meaning of segment. A segment is a storage unit for program code or data objects. Program code is placed in the code segment, and data objects are placed in the data segment. There are two types of segments: absolute segment
[Microcontroller]
Design of large screen LED display system based on GPRS
LED display screen is a new type of information dissemination media that has developed rapidly in the world since the late 1980s. It is a large-scale display system that integrates microelectronics technology, optoelectronics technology, computer technology, and information processing technology. It has gradually b
[Power Management]
Design of large screen LED display system based on GPRS
Wireless and mobile infrared monitoring and alarm system based on ARM9 and GSM/GPRS
Traditional image monitoring systems often have complex wiring, high costs through long-distance wired transmission, and low flexibility. Due to the outstanding advantages of GPRS (General Packet Radio Service) communication technology in medium and low-speed wireless data transmission, image monitoring systems base
[Microcontroller]
Wireless and mobile infrared monitoring and alarm system based on ARM9 and GSM/GPRS
Vehicle monitoring system realized by ARM9 S3C2410 controlling GPRS module
  Aiming at the shortcomings of traditional vehicle monitoring systems based on single-chip microcomputers, GSM technology, ArcGIS (MapInfo or Google Map), such as single function, high communication cost, poor portability and low positioning accuracy, a new vehicle monitoring system solution is proposed: ARM9 S3C2410
[Microcontroller]
Vehicle monitoring system realized by ARM9 S3C2410 controlling GPRS module
Design of remote meter reading system based on CAN/RS485 double-layer network
1. Introduction At present, my country generally adopts the metering and charging method that users' metering instruments, namely water meters, electricity meters, gas meters, and heat meters (four meters), are installed indoors, and meter readers go from house to house, manually read the meters and collect dat
[Industrial Control]
Canon PowerShot G7X Mark III review: Great for video and photos
In early July 2019, Canon released two new camera products, one is the Canon Power G5X Mark II, and the other is the protagonist of this article, the Canon Power G7X Mark III (hereinafter referred to as G7X Mark III). Like its predecessor, the G7X Mark III still focuses on compact body and high-quality performance. It
[Embedded]
Canon PowerShot G7X Mark III review: Great for video and photos
NVIDIA Launches Omniverse Cloud API to Power Industrial Digital Twin Software Tools
Ansys, Cadence, Hexagon, Microsoft, Rockwell Automation, Siemens, and Trimble use Omniverse technology to help customers design, simulate, build, and run physics-based digital twins The NVIDIA Omniverse Cloud API enables developers to integrate Omniverse technology into their design and si
[Industrial Control]
NVIDIA Launches Omniverse Cloud API to Power Industrial Digital Twin Software Tools
RS485/RS232 converter realizes serial communication between PC and microcontroller
1. Overall design of RS485 serial communication interface circuit In the design of the electrical parameter meter, the single-chip microcomputer AT89C52 is responsible for data acquisition, and the upper PC is mainly responsible for communication (including serial communication with the single-chip microcompute
[Microcontroller]
RS485/RS232 converter realizes serial communication between PC and microcontroller
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号