09-22-2021 05:34 AM
Good morning,
I'm having a problem reading from a CPU through serial communication using VISA reading.
I don't understand why if I put the VISA read on a while loop after the execution of that loop the VI does not go on and stays stuck inside the while loop even if I press the stop button.
I'm able to execute also the second loop only if use a for loop reading 1 byte a cycle with N equal to the byte send from the CPU.
It looks like the VI work as intended only if I make the reading loop stop the reading before the CPU stops sending information.
In the VI attached you can find 2 versions of the reading structure
1. one that works using the for loop with N equal to the number of byte sent by the CPU
2. one with the while loop that does not work
This issue is a big problem because I can't know every time the number of bytes sent by the CPU.
Someone knows why this happens and how to avoid this issue?
Thanks in advance.
09-22-2021 09:38 AM
I am going to give you my standard answer to start with...
I highly recommend you watch this video: VIWeek 2020/Proper way to communicate over serial