How to use the available function generator of the microcontroller as a serial port transmitter

Source: Date: 2020-11-25

1. Function generator can be used as serial port transmitter
If you want to debug the serial port with only one switch and the computer is not at hand, you can use the function booster as a serial port transmitter. If your baud rate is 9600, then you can adjust the function generator frequency to 9600/2 =4800HZ, output TTL level directly to RXD, if it is RS232 interface, you can choose function generator bipolar (AC output) if the frequency is unchanged. Note that the level has a peak-to-peak value of 12VPP. When the data received by your microcontroller must be 55H, you can use MOV P1, SBUF, and measure the voltage on P1, so that you can test the serial port without display.
How to use the available function generator of the single chip microcomputer as a serial port transmitter is the same: 55H is 01010101, the start bit of the serial port is 0, 55H bit is sent first, so a frame is 0 (start) 101010101 (stop). 0 (start) 101010101 (stop). It is exactly a square wave with a baud rate of 1/2.


2. If your serial port is to achieve long-distance transmission, how do you know the reliability of the transmission and the adaptability of the signal to the transmission medium?
You can do it like this: Send 00H 0FFH 55H. If these three values ​​are accepted correctly, the network must be able to transmit reliably. This is a point-to-face test method.
Reason: 00H 0FFH is a wide pulse and level (representing energy)/pulse. In terms of signal system, they represent direct current, while 55H is a narrow pulse, which represents the intermediate value of frequency and energy. Since the energy can pass, it can pass, the wide energy can pass too narrow, and the high energy (strong anti-interference) and low energy (representing weak anti-interference) can pass the medium energy. You will believe that the middle and the middle can’t pass the garbage. !


3. Use the sync header to initially realize the baud rate adaptation and judge the start of the data packet. ------7FH, and send continuously when synchronization starts!
Look at the sending of 7FH 0 start 11111110---1 stop
Look at 011111110 more symmetrical! When you receive data with consecutive 1s between two 0s, just divide the time of consecutive 1s by the duration of 0 = 7, indicating that this is the sync header, and the duration of a standard symbol is symbol 0 The duration of the baud rate = 1/(0 symbol duration)

To

Development strength

Professional and experienced software and hardware

Global channels

Provide customers with cost-effective products and services

Quality Assurance

The professional test guarantee team guarantees the stability

After-sales service

Professional technical service team, 24 hours to provide customers