Serial Receive Packet in Arduino simulink block
5 views (last 30 days)
Show older comments
I am new in developing arduino projects using simulink blocks instead of C++. What I am doing now, is I am sending a packet of data consist of 4 uint8 values from Android device (using Simulink support packages for android devices) and receive it in Arduino board. If I only want to send one value eveything is ok. but when I have several values, I need a way to make sure that the packet is correct and no data loss is happend... I used to create a header and terminator or checksum with C++ Code. but with Simulink blocks I dont see this options with Serial blocks for android send and arduino receive... Can you please help me if there is a ready to use block to handle this things: This is how my packet looks like: 65 68 67 69 (Header 4* uint8) data1 data2 data3 data4 10 (Terminator uint8)
I want Simulink to check data stream to make sure that header and terminator are there and packet is correct and not corrupted... when I set the sample rate of transmitter and receiver at the same value, 90% of the times the packet is being received ok but If I use Wireless communication that loss of data is expected, it would be worse... My guess if that there should be a block to check of the characters being received... if it Started with header, It continue to buffer that... If not just flush the stream and ignore it until it gets to next header...
Please help me implement this logic with Simulink
0 Comments
Answers (0)
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!