Joke Collection Website - Public benefit messages - Using LabVIEW serial port to read data
Using LabVIEW serial port to read data
This is mainly because the string you read has a terminator (for example, some communication protocols use 0x0D (carriage return) as the terminator). Suppose there is an ending character, then after you read a string with a corresponding length in the receiving buffer, it will stay in the buffer because the ending character is not considered, and the first character of your next string will move to the next line (carriage return can wrap at the same time), so that you can read the first character of the last time and the rest of the characters except the first character this time. It will produce the phenomenon you said.
solution
Add an operation to clear the buffer after each read.
If you read 12 characters at a time and the ending character is one character, then read one more character at a time, that is, read 13 characters.
In short, just make sure that the receive buffer is empty every time you read it.
- Related articles
- How does Nokia c6 install its own software on the desktop?
- How to cancel QQ VIP membership?
- Tear-jerking sad copywriting
- How many years can you get for sending messages to people nearby by impersonating a bank employee?
- The teacher sent a message in the class that all the students in the class were here. How can I repay the teacher?
- What's the name of Liu Yun's cell phone ring?
- Why doesn't the layout shown above fail?
- How can oppo wallet not send messages?
- Whose fault is the big data stream wrong?
- What if spam messages can't be intercepted?