Data transmission method and device with RS232 capable of automatically adapting to RS485
A data sending device, RS485 technology, applied in the computer field, can solve the problems of cost increase, serial communication conversion complexity, RS232 serial communication program can not automatically adapt to RS485 communication mode, etc., to achieve the effect of low cost and simple serial communication conversion
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0045] In this embodiment of the present invention, since RS485 is a half-duplex communication method, when an application uses RS232 to communicate with an application that uses RS485, it must use the RS485 communication method to communicate, otherwise it will cause the process of sending and receiving. , data loss or data error, in this embodiment of the present invention, after receiving the data sending request from the application layer application, the I / O manager generates a corresponding I / O request packet (I / O Request Packet, IRP) , After receiving the IRP, the RS232 data transmission control is carried out by setting the RS232 request to send signal RTS (Request to Send).
[0046] figure 1 The flow of the RS232 adaptive RS485 data transmission method provided by the first embodiment of the present invention is shown, and the details are as follows:
[0047] In step S101, when an IRP for sending data request is received, the RTS is set to be valid.
[0048] In the em...
Embodiment 2
[0054] figure 2 The structure of the RS232-adaptive RS485 data transmission apparatus provided by the second embodiment of the present invention is shown. For convenience of description, only the parts related to the embodiment of the present invention are shown. Details are as follows:
[0055] When the RTS sending valid setting unit 21 receives the IRP of the sending data request, the RTS is set to be valid;
[0056] In the embodiment of the present invention, the RTS of the serial port RS232 is valid at low level and invalid at high level. When receiving the request information for sending data from the application at the application layer, the I / O manager generates the corresponding IRP, and after receiving the IRP, it will The RTS register is set to be valid, so that RS232 is in the state of data transmission. In a specific implementation process, the RTS can be set to be valid, that is, a low-level state, by means of an interruption, so as to switch the state of the R...
Embodiment 3
[0062] image 3 The flow of the RS232 adaptive RS485 data receiving method provided by the third embodiment of the present invention is shown, and the details are as follows:
[0063] In step S301, when an IRP for receiving a data request is received, the RTS is set to be valid.
[0064] In the embodiment of the present invention, when receiving the data receiving request information of the application layer application, the I / O manager generates the corresponding IRP for receiving the data request, and after receiving the IRP, sets the RTS register to be valid, so that the RS232 is in the data receive status. In a specific implementation process, the RTS can be set to be valid, that is, a low-level state, by means of an interruption, so as to switch the state of the RS232 in real time.
[0065] In step S302, data is received from an application using RS485 communication.
[0066] In the embodiment of the present invention, according to the data sender and the data receiver...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 