Serial Communication Testing Problem About Chip Stc15 Chip Learning

Nothing to do today, once again a long time ago, a board, onboard stc15 chip, to do a serial communication. After reading the data sheet to directly write the program, the serial port fails to test after writing it.

Can not think of its sister, ah, a small serial program written no less than ten times, today how it is nowhere?

Well, honestly look at the data book again (when the small writing program is written in the data book), after reading it is even more depressing, which is no problem, but it is nowhere.

Well, come back to look at the program from scratch, from the declaration to the function definition, from the initialization to the interrupt function, no problem, and finally see the main function.

Because Xiao Bian drives a triode with P3.3 mouth, so lazy wrote:

P3M1=0x00;

P3M0=0xff;

The entire program is just two more than usual. Is it because it caused the serial communication is not normal? Hold the test attitude and change the above procedure to:

P3M1=0x00;

P3M0=0x00;

In the test, the problem is solved perfectly, the serial communication is normal, and the sending and receiving are normal.

Serial Communication Testing Problem About Chip Stc15 Chip Learning

So the problem is here.

This is not too early to conclude, Xiao Bian is still rigorous, and then test it down.

As far as the previous question is concerned, since I'm setting it to output mode, it's logical that we should be able to send data. Right, let's change the code and download the test.

Serial Communication Testing Problem About Chip Stc15 Chip Learning

Sure enough, it can really send data.

At this point, the end of the test, you can boldly say that the problems encountered by Xiao Bian today are caused by the wrong mode of operation of the IO port.

Science:

STC single-chip microcomputer supports the setting of the IO working mode from the 12 series. It has two-way IO compatible with the traditional 51, strong pull-pull output, input, open-drain four modes, we must use the actual use requirements , Please refer to the following figure for the specific setting method.

Serial Communication Testing Problem About Chip Stc15 Chip Learning

In the end, today's question, I believe many small partners have encountered, even here to mention yourself or everyone, you have encountered the same problem, please like it, if you have not encountered the follow-up study do not In the event of such a problem, you encountered headaches on the road to learning SCM. Afterwards, comments and comments were exchanged with you, and Xiao Bian came to learn.

XB5 Series Pushbutton Switch

XB5 series Pushbutton Switch is copy Schnaider newest design, which with high quality plastic material and smart design.In electronics, the switch is an electrical component which can break electrical circuit,interrupting current or diverting it from one conductor to another.The most familiar form of switch is a manually operated electromechanical device with one or more sets of electrical contacts.

XB5 series Plastic Pushbutton Switch

XB5 Series Pushbutton Switch,Push Button Electrical Switch,Led Push Button Switch,Small Push Button Switch

Ningbo Bond Industrial Electric Co., Ltd. , https://www.bondelectro.com