Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Bytes at port outputs all bytes but Visa Read doesn't see them

Solved!
Go to solution

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.

 

Clau_timisoara_0-1653293278094.png       

Clau_timisoara_1-1653293484271.png

 

 

0 Kudos
Message 1 of 9
(1,141 Views)
Solution
Accepted by topic author Clau_timisoara

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 9
(1,122 Views)

Hey. Thanks for your suggestion. It seems sending again the command solved the problem.

 

Clau_timisoara_0-1653309172350.png

 

0 Kudos
Message 3 of 9
(1,108 Views)

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).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 9
(1,102 Views)

I've also thought about it, it seems it doesn't work:

Clau_timisoara_0-1653375528227.png

 

 

Clau_timisoara_1-1653375762442.png

 

Clau_timisoara_3-1653376076426.png

 

0 Kudos
Message 5 of 9
(1,082 Views)

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.

0 Kudos
Message 6 of 9
(1,072 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 9
(1,068 Views)

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

0 Kudos
Message 8 of 9
(1,051 Views)

Thanks, I have given up on Open Visa block.

0 Kudos
Message 9 of 9
(1,045 Views)