Home > other >  51 microcontroller serial port communication problems
51 microcontroller serial port communication problems

Time:10-13

I use a serial port assistant send 51 single chip microcomputer a number, and then the MCU receives the number, and sends the digital computer and displayed on the serial port assistant, but on the computer shows that the number of figures and I send, I send 1, for example, the computer is displayed on the 81, sent is 2, 82, shows a... ah, is this, please ask bosses to solve!

CodePudding user response:

(1) is to determine the serial debugging assistants in hexadecimal or character to send; (2) using the oscilloscope to capture a character of data, a serial port RX pin was sent down 0 x01 is 0 x31;
(3) using the oscilloscope to capture a serial port TX pin a character data, determine how many data is sent out,
And your is through RS232 serial port transceiver to send out? If it is just in the oscilloscope measurement serial port to send data and after RS232 transceiver, the data is consistent, can use the oscilloscope probe two measuring contrast, after receiving the same,

CodePudding user response:

The original poster is sending ASCII characters 1 serial debugging assistant, converted to a decimal is 81,

CodePudding user response:

Try issued by 0 to 255, what was in the receiving, is there any rule
Check the baud rate setting

CodePudding user response:

reference 1st floor SAKURA_CP response:
(1) is to determine the serial debugging assistants in hexadecimal or character to send; (2) using the oscilloscope to capture a character of data, a serial port RX pin was sent down 0 x01 is 0 x31;
(3) using the oscilloscope to capture a serial port TX pin a character data, determine how many data is sent out,
And your is through RS232 serial port transceiver to send out? If it is just in the oscilloscope measurement serial port to send data and after RS232 transceiver, the data is consistent, can use the oscilloscope probe two measuring contrast, after receiving the same,

Hello, my name is transmitted by TTL, must use the oscilloscope, I here no oscilloscope

CodePudding user response:

refer to the second floor of a tree may reply:
the original poster is sending ASCII characters 1 serial debugging assistant, converted to a decimal is 81,

Ok, I see, thank you!

CodePudding user response:

reference CKC reply: 3/f
issued by 0 to 255, what was in the receiving, is there any rule
Check the baud rate setting

Baud rate have any influence, I set is 9600

CodePudding user response:

reference 4 floor trival ヅ DE past reply:
Quote: refer to 1st floor SAKURA_CP response:
(1) is to determine the serial debugging assistants in hexadecimal or character to send; (2) using the oscilloscope to capture a character of data, a serial port RX pin was sent down 0 x01 is 0 x31;
(3) using the oscilloscope to capture a serial port TX pin a character data, determine how many data is sent out,
And your is through RS232 serial port transceiver to send out? If it is just in the oscilloscope measurement serial port to send data and after RS232 transceiver, the data is consistent, can use the oscilloscope probe two measuring contrast, after receiving the same,

Hello, my name is transmitted by TTL, must use the oscilloscope, I here no oscilloscope


You are using USB to TTL, that would save the RS232 transceiver problem, then you use the 51 chip can online debugging? If can directly into the debug mode to see the data received, if you can't online debugging, open the device manager to see turn USB serial port how much is the default baud rate, should be the problem of baud rate, if the debugging assistant baud rate or display is wrong, you have to confirm whether the hardware on 51 chip crystals is not 11.0592 M, leads to 51 chip baud rate appeared deviation,

CodePudding user response:

Is the serial debugging assistants in hexadecimal or send characters

CodePudding user response:

Should is about the character of upstairs into the system, code display mode is different, it is ok to do the conversion should be,

CodePudding user response:

Atoi function
  • Related