Microcontroller Serial Port Introduction, 8051 Microcontroller Communication Mode

The serial port is a tool for the information exchange between the microcontroller and the outside world. There are two communication methods for the 8051 microcontroller:

Parallel communication: Each bit of data is sent or received at the same time.

Serial communication: Data is sent or received one bit at a time.

Serial communication

Asynchronous communication

A start bit 0 indicates the beginning of the character, a stop bit 1 indicates the end of the character, and 8 data bits are sandwiched therebetween. Characters can be transmitted one after the other

There must be two rules of character format and baud rate between CPU and peripherals

The character format specification enables both parties to understand that the 0 and 1 strings have the same meaning. In principle, it is free to formulate, and general-purpose standards such as ASCII are used.

The baud rate is the data transmission rate, the number of binary bits transmitted per second, such as 120 characters/s, 10 characters per character, then the transmission baud rate is 1200 baud

Synchronous communication

The start and end flag is removed to increase the speed, but since the start of the data block transfer is indicated by the synchronization character and the synchronization between the sender and the receiver is required by the clock, the hardware is complicated.

Communication direction

In serial communication, a one-way transmission method in which a communication interface can only send or receive is called a simplex transmission; and bidirectional transmission is a bidirectional transmission of data. Half-duplex transmission between the two machines can not send and receive at the same time, at any time, can only send or only receive information. Full duplex transmission is able to send and receive at the same time.

Serial interface structure

51 single-chip microcomputer a programmable full-duplex serial communication interface. Can be used as asynchronous communication mode (UART), connected with external devices that transmit information serially. Or 8051 multi-machine systems for full-duplex operation using synchronous or asynchronous standard communication protocols, use TTL or CMOS shift registers to expand the I/O ports.

8051 microcontroller through the pin RXD (P3.0, serial data receiver) and pin TXD (P3.1, serial data transmitter) to communicate with the outside world. SBUF is a serial port buffer register that includes a transmit register and a receive register. They have the same name and address space, but there is no conflict because they can only be read by the CPU and only one CPU can write data.

Serial Port Control and Status Registers

Serial Port Control Register SCON

Used to define the working mode of serial port and implement receive and send control. The byte address is 98H.

SM0, SM1: Serial Port Operation Mode Selection Bits

How the serial port works

Mode 0

â—‹ is the shift register input/output method. External shift registers can be used to expand the I/O ports, and external input/output devices can also be externally connected. 8-bit serial data is input or output from RXD, and TXD is used to output sync pulses. â—‹ Output: The terminal flag T1 is set by hardware after transmission. (Same as other) â—‹ Input: When RI =0 and REN =1, the start of reception is satisfied at the same time. After receiving the eighth bit, the data is moved to the register and the hardware sets RI.

Mode 1

â—‹ 10 bit asynchronous communication with variable baud rate. â—‹ Output: When an instruction is executed to write data to the transmit buffer SBUF, transmission is started, and a frame is sent after hardware is set. T1 â—‹ Input: Detect 1-0 transition, clear RI and SM2 by software before use

Mode 2

â—‹ 11 bit UART mode with fixed baud rate. It adds a ninth digit that can be programmed to 1 or 0 over Mode 1. â—‹ Output: 11 bits, the additional ninth bit is TB8 bit of SCON, which can be used as address/data information flag bit and parity correction bit in multi-machine communication. Others with other â—‹ Input: 123 same

Mode 3

This is a 11-bit UART with variable baud rate. With the exception of the baud rate, the rest is the same as Mode 2.

Baud rate selection

Mode 0: The baud rate of Mode 0 is fixed at 1/12 of the main oscillator frequency.

Method 2:

The baud rate is determined by the SMOD bit in PCON

Baud rate = 2SOMD/64*fosc, SMOD = 0 or 1

Modes 1 and 3:

Baud rate = Timer T1 overflow rate

T1 overflow rate = T1 count rate / cycles required to generate overflow

The T1 count rate depends on whether it operates in the timer state or the counter state.

â—‹ When working in the timer state, the T1 count rate is fosc/12; â—‹ When working in the counter state, the T1 count rate is the external input frequency, which should be less than fosc/24.

The cycle required to generate an overflow is related to the operating mode of timer T1 and the preset value of T1.

â—‹ Timer T1 works in mode 0: Number of cycles required for overflow = 8192-x â—‹ Timer 1 operates in mode 1: Number of cycles required for overflow = 65536-x â—‹ Timer T1 works in mode 2: Number of cycles required for overflow =256-x

Because mode 2 is an 8-bit timer/counter mode that automatically reloads the initial value, it is most appropriate to use it as a baud rate generator.

Business 1080p Projector

The 1080P high-definition projectors on the market can be roughly divided into three grades: high, medium, and low. The low-end products are mainly aimed at the entry-level market. In terms of performance, they can fully meet the needs of watching various HD videos. In terms of adjustment, it tends to be simpler, mainly to allow entry-level users to quickly set up the projector, but the contrast of such projectors is generally not very high, and the overall picture effect is relatively general; mid-range projectors mainly have certain projector knowledge. , the projection picture also has a better performance, the most important contrast of the cinema projector has also been greatly improved, the projector adjustment tends to be more professional, and it is also equipped with various additional functions to improve the projection effect; high-end products are Mainly aimed at enthusiast players, both price and performance are the symbol of flagship. For commercial use, in addition to satisfying home entertainment applications, 1080P high-definition standard projectors can also support clear and delicate text and table content projection for business office applications that often conduct office text, PPT presentations, and video presentations. .

4k meeting room projector,video projector for meeting room,conference room led projector,lcd meeting room projector,business 1080p HD projector

Shenzhen Happybate Trading Co.,LTD , https://www.happybateprojectors.com