Incorrect Serial Data on Receive BlocklyProp and FLiP
wgreene
Posts: 5
I hope someone can help me understand why II am not seeing the serial data I'm expecting to see with the Serial receive block. Here is the link to my code for reference:
http://blockly.parallax.com/blockly/editor/blocklyc.jsp?project=108331
If you disable the Serial receive and the Print text serialRcv, you should see the serial data as expected: 0,Test and a carriage return--and the counter increases by 1 each time through the loop. Now, enable the Serial receive and Print text serialRcv. The received data does not match the transmitted data, and the carriage return does not seem to carry over, either. Can someone explain what I am missing?
Thanks so much,
Wayne
http://blockly.parallax.com/blockly/editor/blocklyc.jsp?project=108331
If you disable the Serial receive and the Print text serialRcv, you should see the serial data as expected: 0,Test and a carriage return--and the counter increases by 1 each time through the loop. Now, enable the Serial receive and Print text serialRcv. The received data does not match the transmitted data, and the carriage return does not seem to carry over, either. Can someone explain what I am missing?
Thanks so much,
Wayne
Comments
I mean... you are ending data, and then expecting to read it afterwards. That's ok if the block is receiving all data behind the scenes, but not ok if there is no buffering behind the scenes, as the data will already have been transmitted by the time you call receive, so you will have missed the data. So you might need to experiment with a second cog (processor) doing either the tx or receive.
As a quick test, you might try moving the serial receive block so that it's directly under the serial tx block. Then followed by the two Transmit print blocks. With this change, do you get different consistent results ? That would prove the prior theory that the rx block is not internally buffered and would need you to handle that in code.
0,Test
0,Test
1,Test
1,Test
2,Test
2,Test
3,Test
3,Test
4,Test
4,Test
5,Test
5,Test
6,Test
6,Test
est
est
15,Test
15,Test
16,Test
16,Test
17,Test
17,Test
18,Test
18,Test
19,Test
19,Test
20,Test