05-23-2022 03:18 AM
Hello. I have a display connected to a PC via RS232 port. With a VI I want to extract all the bytes stored on display's memory. I've disabled termination character in VISA Configure serial port as seen in other topics. When Bytes at port isn't connected to Visa Read, it outputs 387 bytes and Visa Read outputs the number I specify at byte count terminal. When these two are connected, Visa Read outputs at read buffer terminal the message Unknown Command and at return count terminal the result 22. Can someone explain why those 387 bytes aren't seen by the Visa Read when connected to Bytes at port? Thanks in advance.
Solved! Go to Solution.
05-23-2022 05:31 AM
It appears to me that the device simply isn't sending a bunch of data. It looks like there is something else in the device's buffer so that when you send your command, it looked like an invalid command. Maybe try sending the command again after you get the "unknown command" error and see if you get your data.
Additionally, you do not need the VISA Open (it is open after the VISA Configure Serial Port) nor the VISA Clear (closing the resource will clear the buffers). You should also be propagating the error wire from function to function so you can see if you are getting an error through this process.
05-23-2022 07:33 AM
Hey. Thanks for your suggestion. It seems sending again the command solved the problem.
05-23-2022 09:00 AM
Thinking about this a little more, I would turn the Termination Character back on and set it to be the '>' character (0x3E, 0d62). Then you don't need to worry about the 2 second wait nor the Bytes At Port. You just try to read immediately after the write and let it time out if there is no response (default is 10 second timeout).
05-24-2022 02:09 AM
I've also thought about it, it seems it doesn't work:
05-24-2022 04:45 AM
Me again, your second solution works as long as I put a bigger number at byte count terminal at Visa Read than the existing bytes in display's memory, but I had to make the VI valid for any number of bytes in memory, assuming we don't know this info.
05-24-2022 05:30 AM
@Clau_timisoara wrote:
Me again, your second solution works as long as I put a bigger number at byte count terminal at Visa Read than the existing bytes in display's memory, but I had to make the VI valid for any number of bytes in memory, assuming we don't know this info.
Yes, you have to set the bytes to read to a very large number. Given your situation, I would probably go with 4096.
05-25-2022 10:55 AM
I think the VISA Open might be overwriting some of your settings, you can remove it since the session is already open - like crossrulz said.
Second, VISA Read byte input when using a termination character just allocates some memory. You seem to have less than 500 bytes at port, so why not just use 50000 as the input to the VISA Read. A factor of 100 should not cause any problems and I'm sure the VISA Read and display would timeout before reading that many.
Since crossrulz didn't plug it you should watch his Serial Communications video - https://www.youtube.com/watch?v=J8zw0sS6i1c
05-25-2022 01:27 PM
Thanks, I have given up on Open Visa block.