Commercial use prohibited! Commercial use prohibited! Commercial use prohibited!
Bip site video link: To be continued...
Physical picture:


Function introduction:
Use CH3400N to realize USB to TTL;
onboard TYPE-C female socket, supports dual C line communication; also comes with a USB male connector, which only needs to be used when using Can choose one of the two;
STC microcontroller supports automatic cold start when downloading the program, the success rate is as high as 99.9%;
disconnect the positive and negative poles at the same time during cold start, maximizing the success rate of cold start;
with a manual cold start button, manual cold start has The highest priority, manual cold start can be performed under any circumstances;
long press the manual cold start button to enable or disable automatic cold start;
there are two voltage sources of 5V and 3.3V onboard, and the 5V driving capability is equivalent to the connected power supply. 3.3V can provide up to 800ma driving current;
the power supply, TXD and RXD have independent indicator lights.
Working principle:
Use the STC8G1K08A microcontroller serial port to monitor the data sent by the TXD port in real time to achieve automatic cold start;
STC-ISP will continue to send 0X7F data after clicking to download the program. When a certain number of 0X7F is received, it will control the positive and negative MOS tubes to turn off. off, and then on again after a period of time to achieve automatic cold start;
the 3.3V voltage is converted by AMS1117, and the maximum sustainable current is strongly related to the quality of the device used.
Program analysis:
Program analysis only talks about key points. Please refer to the program body in the attachment for specific details.
1-1. STC8G1K08A has a total of six IOs. The following are pin definitions. All pins except P3^0 can be customized. Note: After modifying the pin function definition, the hardware connection must also be modified accordingly, otherwise it will not work properly!

1. First assign the data received by the serial port to a custom variable; and set the flag to 1.

2. Determine whether the reception is completed; when the reception is completed, determine whether the received data is 0X7F; if it is 0X7F, add one to the count variable.

3. Continuously receive 16 or more (customized number) 0X7F; control the MOS tube to turn off and then turn on again after 800 milliseconds; clear the flag bit.

4. After the cold start is completed, it will be delayed for a period of time before the next cold start count can be started; the starting point of this function design is to avoid frequent cold starts in a short period of time, which may induce various BUGs; RTS is a function of CH340N during RS232 and RS485 communication. The characteristic of the pin used is that it outputs a low level when there is data transmission and a high level when there is no data transmission. Here, its characteristics are used to jump out of the delay immediately after the download is completed, avoiding the need for additional waiting during continuous downloads.

5. The implementation of manual cold start is very simple, which is to continuously detect the IO level of the button. Once it is pulled low, it will be cold started once.

6. The recognition of long-pressed buttons is achieved through a series of judgments and cycles; long-pressed for about 2 seconds, the TXD and power indicator lights will alternately flash 5 times to indicate disabling or enabling.

7. After being disabled, the MOS tube is normally connected and is no longer controlled by TXD data. Manual cold start can still be used.

8. Exit the disabling function by long pressing.