Showing results for 
Search instead for 
Did you mean: 

Reading time interval of serial port


Because you only do something with the data from the VISA read if you get at least 19 bytes.  If it is less than 19 bytes, you concatenate it to another string that is stored in a shift register (by the way, you say array, but you don't have any arrays).  But at any point of time you do get at least 19 bytes in your VISA read, you don't do anything with that data, and that shift register gets an empty string put into it.

0 Kudos
Message 11 of 15

I agree and suspected as much when I saw that image of yours. This is why it is important to attach the actual code. If you had done that initially, there would have been less time wasted in guessing.


p.s. Disable the termination character if you are reading binary.

0 Kudos
Message 12 of 15

I monitor the shift register. If the loop is set to 1ms. It will be blank all the time.

0 Kudos
Message 13 of 15

If you set the loop interval to 1 ms, you'll never get 19 bytes at a time.  You'll be lucky to get 1 byte at a time at 9600 baud.

Message 14 of 15

Ravens Fan is correct.


If you look at the snippet that I posted earlier, you will notice that the delay in the loop is 10ms.  It can be greater, but I would not make it any smaller value.

Message 15 of 15