I'm trying to set up serial port communication between host and target and get VISA read error.
Here is what the code does (also see the attached VI)
write - "VISA Write" sends out "connection" command from host contiuously.
read - use state machine to read response from target by byte with "VISA Read" and check if the byte is the expected value. If yes, read the next byte,,,,until the end of byte.
There is no problem with write operation, but VISA read always gets the errors
0xBFFF006B (A framing error occurred during transfer) and
0xBFFF0015 (Timeout expired before operation completed)
"Unflatten From String" of the 1st state gets the error "Memory or data structure corrupt"
Any suggestions? Thank you.
I switched the laptop with virtual serial port to a desktop with real serial port and it seems working fine 99% of the time.
When I used the laptop with virtual serial port, it didn't work 99% of the time. And when it didn't work, an unexpected character was prepended at the output of VISA read.
Why would you even need to be constantly sending the exact same data at a high rate? Typically, you send the command and wait for the response - all in the same loop.
Thank you, everyone. The problem is fixed although I'm not so sure why the 1st byte read from port is not the 1st byte write to port. I changed the type of "Unflatten From String" to an array of byte in the first case "Start Byte 1".
This VI is to set up the serial communication. Our protocol requires continuous "connect" command until it's get connected. But once the communication is set up, "read" or "write" command will be sent out once only.