Industrial RS-232 interface bus principle and application program

The RS-232 interface complies with the interface standard for serial data communication established by the Electronic Industries Alliance (EIA). The original number is EIA-RS-232 (232, RS232 for short). It is widely used for computer serial interface peripheral connections.

RS-232 is one of the mainstream serial communication interfaces. Due to the early appearance of the RS232 interface standard, it is inevitable that there are deficiencies, mainly the following four points:

(1) The signal level of the interface is high, which is easy to damage the chip of the interface circuit. The voltage of any signal line on the RS232 interface is in a negative logic relationship. That is: the logic "1" is -3- -15V; the logic "0": +3- +15V, the noise margin is 2V. That is, the receiver is required to recognize a signal higher than +3V as a logic "0", a signal lower than -3V as a logic "1", a TTL level of 5V as a logic positive, and 0 as a logic negative. Incompatible with the TTL level, a level shifting circuit is required to connect to the TTL circuit.

(2) The transmission rate is low. When transmitting asynchronously, the baud rate is 20Kbps.

Industrial RS-232 interface bus principle and application scheme

(3) The interface uses a signal line and a signal return line to form a common ground transmission form. This common ground transmission is prone to common mode interference, so the noise immunity is weak.

(4) The transmission distance is limited. The maximum transmission distance is 50 feet. In fact, it can only be used at about 15 meters.

Industrial RS-232 interface bus principle and application scheme

There are two types of serial port 232, the first one: DB9; the second type: DB25; the following are introduced separately.

DB9 interface wiring instructions:

1 DCD carrier detection

2 RXD receiving data

3 TXD send data

4 DTR data terminal is ready

5 SGND signal ground

6 DSR data is ready

7 RTS request to send

8 CTS clear send

9 RI ringing prompt

DB25 interface wiring instructions:

1 shielded ground wire

2 TXD send data

3 RXD receiving data

4 RTS request to send

5 CTS allows to send

6 DSR data is ready

7 SG signal ground

8 DCD carrier detection

9 send back (+)

10 undefined

11 data transmission (-)

12~17 undefined

18 data reception (+)

19 undefined

20 data terminal ready for DTR

21 undefined

22 Ringing RI

23~24 undefined

25 Receive back

The most used in practical applications is the DB9 interface. If you encounter the DB25 interface, you can change it by changing the wiring method. DB25 to DB9 wiring method.

Industrial RS-232 interface bus principle and application scheme

In the RS-232 standard, characters are transmitted serially one after another in a serial manner. The advantage is that the transmission line is small, the wiring is simple, and the transmission distance can be far. The most common encoding format is the asynchronous start-stop format, which uses a start bit followed by 7 or 8 data bits, followed by an optional parity bit, and finally one or Two stop bits. Therefore, sending a character requires at least 10 bits, and a good effect is to make the entire transmission rate, the rate of the transmitted signal, divided by 10. One of the most common alternatives to asynchronous start-stop is to use the Advanced Data Link Control Protocol (HDLC).

Logic 1 and Logic 0 voltage levels are defined in the RS-232 standard, as well as standard transmission rates and connector types. The signal size is between positive and negative 3-15v. RS-232 specifies that the level close to 0 is invalid, logic 1 specifies a negative level, and the signal state of the effective negative level is called mark marking, its function meaning is OFF, logic 0 is specified as positive level, and effective positive power The flat signal state is called the space number spacing, and its functional meaning is ON. Levels of ±5, ±10, ±12, and ±15 are possible depending on the power supply of the device.

The RS-232 was originally designed to connect to a modem for transmission, and therefore its pin significance is often related to modem transmission. RS-232 devices can be divided into data terminal equipment (DTE, Data Terminal Equipment, For example, PC) and data communication equipment (DCE, Data CommunicaTIon Equipment). This classification defines different lines for sending and receiving. signal. In general, computers and terminal devices have DTE connectors, and modems and printers have DCE connectors. But this is not always strictly correct. Use a wiring tap to test the connection, or use trial and error to determine if the cable is working. You often need to refer to the relevant documentation.

Serial communication requires multiple settings in the software settings. The most common settings include Baud Rate, Parity Check, and Stop Bit.

Baud rate (also known as baud rate): refers to the baud rate from one device to another, that is, how many bits per second per second (bit / s). Typical baud rates are 300, 1200, 2400, 9600, 15200, 19200, etc. Generally, the devices at both ends of the communication must be set to the same baud rate, but some devices can also be set to automatically detect the baud rate.

Parity (Parity: is used to verify the correctness of the data. Parity is generally not used, if used, then you can do Odd Parity or Even Parity. Parity It works by modifying each transmit byte (and can also limit the bytes sent). If no parity is used, the data will not be changed. In even parity, because the parity bit will be corresponding Set to 1 or 0 (usually the highest or lowest), so the data will be changed so that the number of "1"s in all transmitted digits (including digits and check digits of characters) is even; In the test, the number of "1"s in all transmitted digits (including digits and check digits of characters) is odd. Parity can be used by the receiver to check whether the transmission is sent or not - if it is in a byte If the number of "1" has an error, then this byte must have an error in the transmission. If the parity is correct, then either no error occurs or an even number of errors occur. If the user selects a data length of 8 Bit, then Is no extra bits can be used as an Laid, therefore it is called "bit (Non Parity)".

Stop Bit: This is sent after each byte transfer and is used to help accept the signal side hardware resynchronization.

RS232 read and write timing diagram:

Industrial RS-232 interface bus principle and application scheme

Below is a list of programming examples. Because RS232 programming uses 51 single-chip microcomputers, there is too much history, so I will share with you a RS232 communication routine written by DSP. Because DSP files and header files are relatively large, I just shared the communication part of the program. If you need a complete project, you can send a message to the public number. We will reply as soon as we see it and send it to your email address.

Brief description of the program: development environment CCS4.2, chip TMS320F2812, mode: interrupt mode read and write

Use module: SCIA module

DSP serial communication is very different from single-chip serial communication, but the basic communication process is the same. The first is to configure GPIO (there is a need for configuration due to more modes, the normal MCU does not need to be configured). After the configuration is completed, the communication parameters are set. After the parameter setting is completed, the interrupt can be used to send and receive. (Send can also use interrupts, I just wrote a process, in actual use, according to the function to write, I wrote the transmission is always sending data), the following is the program.

Industrial RS-232 interface bus principle and application scheme

Industrial RS-232 interface bus principle and application scheme

Industrial RS-232 interface bus principle and application program

Industrial RS-232 interface bus principle and application program

High Precision Linear CT

Our company`s current transformers have high precision,wide range,small volume and good linearity that can be used to the field of electronic watt-hour meter, electric energy metering, electronic detection.

Performance

●Power frequency insulation strength:The insulation between the primary winding and the secondary winding and the ground part of the CT can bear 4kV power frequency voltage for 1minute

●Interturn insulation strength:The secondary open circuit, the primary winding through the rated current 1min, no inter-turn damage in the transformer

●The deviation is better than the industry standards and national standards

High Precision Linear Ct,Useful Current Transformer,Customized Current Transformer,Durable Current Transformer

Anyang Kayo Amorphous Technology Co.,Ltd. , https://www.kayoamotech.com

Posted on