04-16-2013 11:14 AM
I am using VISA to read 179 bytes from a Agilent 3458A connected through GPIB. I noticed that as I continue to run my read vi, more digital form the bottom value will wrap around. Have you seen this?
2
1.995951462E-02
1.995958701E-02
1.995955596E-02
1.995953467E-02
1.995953733E-02
1.995969452E-02
1.995944259E-02
1.995943567E-02
1.995962604E-02
1.995952030E-
Solved! Go to Solution.
04-16-2013 11:49 AM
It more likely that is data left over from your previous read. You might want to try reading more. Is the instrument setup to use a termination character? That would be the best way to go in situations like this.
04-16-2013 03:21 PM - edited 04-16-2013 03:25 PM
@crossrulz wrote:
It more likely that is data left over from your previous read. You might want to try reading more. Is the instrument setup to use a termination character? That would be the best way to go in situations like this.
Yes, That instrument can be configured to send \r or not on EOI. Be a bit cautious with that though since it can also be configured to send scale, offset and raw ADC values (speeds up large data transfers) youl'd be surprised how often you can get an ADC count of 0d10 and leave data in the buffer. (And how many man-hours it takes to find that bug when you are new.)
The odds are the term character IS enabled and you are not accounting for it in your reads leaving an increasing number of charaters in the buffer with each read
04-16-2013 05:01 PM
@JÞB wrote:
Yes, That instrument can be configured to send \r or not on EOI. Be a bit cautious with that though since it can also be configured to send scale, offset and raw ADC values (speeds up large data transfers) youl'd be surprised how often you can get an ADC count of 0d10 and leave data in the buffer. (And how many man-hours it takes to find that bug when you are new.)
Yep, been there. But as long as you are just using ASCII, the termination character is by far the best way to go. And if the VISA session is set up to use the termination character, just set the bytes to read something absolutely rediculous (like 1000). You should then get a good read. Oh, if you are getting a lot of data in this fashion, also make sure the VISA Timeout is decently high. The default 10 seconds should be plenty fine.
04-16-2013 06:05 PM
@crossrulz wrote:
@JÞB wrote:
Yes, That instrument can be configured to send \r or not on EOI. Be a bit cautious with that though since it can also be configured to send scale, offset and raw ADC values (speeds up large data transfers) youl'd be surprised how often you can get an ADC count of 0d10 and leave data in the buffer. (And how many man-hours it takes to find that bug when you are new.)Yep, been there. But as long as you are just using ASCII, the termination character is by far the best way to go. And if the VISA session is set up to use the termination character, just set the bytes to read something absolutely rediculous (like 1000). You should then get a good read. Oh, if you are getting a lot of data in this fashion, also make sure the VISA Timeout is decently high. The default 10 seconds should be plenty fine.
The 3458A has a LOT of memory (for a 1960's device) and the driver does have a few "idiosyncrasies"
Enable the term char, trap the warning, check the buffer.
04-17-2013 09:50 AM
I did some digging, and the default timeout for VISA read is 2second. I actually had to change the timeout to 4s for it to work.
http://digital.ni.com/public.nsf/allkb/E4F90AD24DEC9CC786256F4300605C02
04-17-2013 09:53 AM
I did some some troubleshooting, and I arrived to the same conclusion. The wrap around is left over from the previous data point. I didn't create this code, so I am making as little change to it as possible. It seems liek after I changed the GPIB read node to VISA read node, I have to read 180 bytes instead of 179 to get the expected amount of data.
04-17-2013 11:06 AM
@jyang72211 wrote:
I did some some troubleshooting, and I arrived to the same conclusion. The wrap around is left over from the previous data point. I didn't create this code, so I am making as little change to it as possible. It seems liek after I changed the GPIB read node to VISA read node, I have to read 180 bytes instead of 179 to get the expected amount of data.
That would do it. There is a slight difference in end mode on reads GPIB and VISA (End on EOI vs End on Term Char not all VISA supported busses have parallel handshake lines) so you need to add the term char to the count when migrating.