Incorrect Serial Data on Receive BlocklyProp and FLiP

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

Comments

  • VonSzarvasVonSzarvas Posts: 1,587
    edited 2019-08-18 - 12:28:24
    I'm not familiar with the serial receive block, but is that buffered ?

    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.
  • Also to double check... you do have pins 24 and 25 connected somehow, on the FLiP ?

    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.
  • Thanks for the suggestion. Moving the blocks as suggested did not fix the problem. I did disable the first Print text block, but kept the second, which is supposed to be the received serial data. The following is copied direct from the terminal window. Also, the carriage return is not working. I'm utilizing the "then a new line" check box for this demo. and...instead of running forever, the data stopped on number 20.

    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
Sign In or Register to comment.