Hey dear NI community!
I am losing bytes... and I assume, I am doing so during the first loop of my programme.
Below the .vi is attached. Here is a screenshot of the block diagram and the 'live feed' monitor indicating missing bytes (explanation following):
Here is how the programme works:
My Arduino Mega2560 sends the data of 16 pins + the marker string 'xx' in a continuous cycle. Now I want to monitor these pins.
1. 34 (=16pins*2[bytes]+2['xx']) bytes are read and checked for the 'xx' sequence.
2. The index of the first character after 'xx' determines how many more bytes have to be read before our loop starts. (The purpose behind this is to have the 34-bytes-strings during each loop to start with the 32 data bytes followed by the marker bytes 'xx'.)
3. The loop takes 34 bytes and evaluates the first two bytes corresponding to the value of the first pin.
The 'before loop correction' shows, that the used string ends with 'xx' right before the start of the loop. Measuring the loop-bytes with 'live feed' however shows data, where 'xx' is not at the end, rendering the evaluation of my string impossible. (Note: 'xx' in hexadecimal display is '7878', so the byte string in the picture above is off by one byte.) Also note, that once the programme is started, the false position of '7878' stays the same, as if the byte lose occurce once.
Any ideas?
Kind regards,
Friedrich G. Froebel
PS: The Arduino Mega2560 is operating at 38400 bauds. Higher values are not accepted. Do you know why or how I could fix this?