Two-way communicationUsually, the serial port on the PC is a full-duplex device, which means that it can send and receive data at the same time. To do this, it uses separate lines for sending and receiving data. Some types of serial devices only support one-way communication, so only two wires are used in the cable, the transmission wire, and the signal ground wire. Some industrial IoT communication devices are bidirectional communication devices, such as the common serial port server USR-TCP232-410s, industrial router USR-G806, DTU device USR-G780 V2, and other devices. SPI-модульPoint-to-point communicationAfter sending the start bit, the transmitter sends the actual data bits. Depending on the number selected, there may be 5, 6, 7, or 8 data bits. Both the receiver and the transmitter must agree on the number of data bits and the baud rate. Almost all devices use 7 or 8 data bits to transfer data.Note that ASCII values greater than 127 cannot be sent when using only 7 data bits. Again, use 5 bits to limit the maximum possible value to 31. After the data is sent, the stop bit is sent. The value of the stop bit is 1 (or the flag state), and the stop bit is correctly detected even if the value of the previous data bit is also 1. This is achieved by the duration of the stop bits. The length of the stop bits can be 1, 1.5, or 2-bit periods.Parity bitIn addition to the synchronization provided through the use of start and stop bits, an additional bit called a parity bit can optionally be sent with the data. Parity bits provide a small amount of error checking to help detect data corruption that may have occurred during transmission. You can choose even parity, odd parity, mark parity, space parity, or none at all. When using even or odd parity, the number of flags (logical 1 bits) in each data byte is counted and a bit is sent after the data bits to indicate whether the number of 1 bit just sent was even or not an odd number.For example, when even parity is selected, the parity bit is sent with a value of 0 if the number of preceding flags is even. For the binary value 0110 0011, the parity bit will be 0. If even parity is valid and the binary number 1101 0110 is sent, the parity bit will be 1. Odd parity is just the opposite, the parity bit is 0 when the number of flag bits in the previous word is odd. Parity error checking is very basic. While it will tell you if there is a single bit error in the character, it will not show the bit received in error. Also, if an even number of bits are in error, the parity bits will not reflect any errors at all.Mark parity means that parity bits are always set to mark signal condition, similarly, space parity always sends parity bits under space signal condition. Since these two parity options are useless, they are almost never used.RS-232CRS-232 stands for Recommended Standard No. 232, and C is the latest version of the standard. Serial ports on most computers use a subset of the RS-232C standard. The full RS-232C standard specifies a 25-pin "D" connector, of which 22 are used. Most of these pins are not needed for normal PC communication, and in fact, most new PCs are equipped with male D-type connectors with only 9 pins.DCE and DTE equipmentDTE and DCE are two terms commonly used in IoT. DTE stands for Data Terminal Equipment and DCE stands for Data Communication Equipment. These terms are used to indicate the pinout of the connector on the device and the direction of the signals on the pins. Your computer is a DTE device, while most other devices are usually DCE devices.If you're having trouble keeping the two connected in line, replace the term "DTE device" with "your PC" and the term "DCE device" with "remote device" in the following discussion. UART-модульThe RS-232 standard specifies that DTE devices use a 25-pin male connector, while DCE devices use a 25-pin female connector. Therefore, you can connect the DTE device to the DCE using a direct pin-to-pin connection. However, to connect two similar devices, a null modem cable must be used instead.