??? 11/20/04 11:52 Read: times |
#81570 - MCU & PC communication Responding to: ???'s previous message |
Sounds like you're missing characters! Obviously your comms is not too robust! I would suggest you packetise the data so that you can guarantee the PC will get the data in the right order or none at all. Normally you have a start token,maybe some means of determining the packet length (if it is variable), the data and then a checksum, CRC or some means of checking the data. For example :A1B1C1D1<checksum><CR><LF> the : is the start token B1B1C1D1 is your data <checksum> is the sum of the characters after the ':' <CR><LF> are carriage return (0x0d) and line feed (0x0a) to terminate the packet. On the receive side, your VB code can do a line input. You then check the first character is a ':', if not reject the packet. You then calculate the checksum on the characters you received and compare that to the received checksum. If all chars were received, the checksum will match. You have a very good chance that all your data was received correctly. Packetising your data allows you to not only check the data, but to know when you've got errors - you can keep statistics of this. Obviously if your error count is rising, you've got comms problems. The other side of your problem is the data rate - Windows has a limited buffer, if you exceed this with no handshaking, characters WILL be lost. For an example of an industrial comms protocol, see www.modbus.org and get their serial comms spec. There's a million ways to implement comms, but it's best to use something that is already a standard. |
Topic | Author | Date |
Need help... MCU and PC communication | 01/01/70 00:00 | |
MCU & PC communication | 01/01/70 00:00 | |
I have the same problem | 01/01/70 00:00 | |
Need more help from this | 01/01/70 00:00 | |
I use ascii | 01/01/70 00:00 | |
Reply to Jose' | 01/01/70 00:00 | |
Fix the problem | 01/01/70 00:00 | |
To my helpers | 01/01/70 00:00 | |
Handshaking... | 01/01/70 00:00 | |
RETI | 01/01/70 00:00 | |
ascii ? | 01/01/70 00:00 | |
Handshaking and More !! | 01/01/70 00:00 | |
Delays | 01/01/70 00:00 | |
Thanks to all my helpers, problem solved | 01/01/70 00:00 | |
Delays | 01/01/70 00:00 | |
Delays | 01/01/70 00:00 | |
UART, mode 3 | 01/01/70 00:00 | |
The 9th bit is the parity for VB | 01/01/70 00:00 | |
send data from mcu to pc | 01/01/70 00:00 | |
Yes, but the 9th bit is the parity in VB | 01/01/70 00:00 | |
9th bit lost by Windoze? | 01/01/70 00:00 | |
9th bit is supported | 01/01/70 00:00 | |
32-bit MS Windows![]() | 01/01/70 00:00 |