LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa read getting wrong data from Lake Shore 340

I'm having a problem with my Visa read functions getting the wrong data out of my Lake Shore 340.

 

It appears that the 340 will occassionally store previous commands such that if I send an IDN? command the response I get could be a temperature, set point, heater output, etc, from previous commands that I've already sent. So I can send it a command to read heater output but will receive the response for temperature or heater resistance.

 

If I repeatedly send it the same command enough times (like IDN?) it seems that I can get through all the previous commands so it give me the correct response for IDN? but it only reads an answer every other iteration. 

 

I've never seen this kind of behavior before, and don't understand what is happening.


 

0 Kudos
Message 1 of 6
(1,638 Views)

Sounds like data is left in your buffer from previous querries that were not properly read.  I would need to examine code to make any more evaluations.



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 6
(1,626 Views)

Thanks for your reply! That idea makes a lot of sense.

 

Unfortunately, due to policy reasons, I'm not sure if I'll be able to post my VI.

 

  • Briefly, I have teo horizontal sequence structures with specific read/write commands separated by 50ms wait functions. These are in a case structure that has a switch wired to it. The true and false cases have different commands depending on what the user needs to set or read from the instrument. When I flip the switch, to send a different set of commands I start getting issues.

I appreciate any thoughts!

0 Kudos
Message 3 of 6
(1,599 Views)

Hi Nadweb,

 


@Nadweb wrote:

Briefly, I have teo horizontal sequence structures with specific read/write commands separated by 50ms wait functions. These are in a case structure that has a switch wired to it. …

I appreciate any thoughts!


Replace that flat sequences in cases of a case structure by a proper statemachine approach!

Send one command, read its response.

Send next command, read.

Wash, rinse, repeat…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(1,572 Views)

Statemachines always trip me up if I'm being perfectly honest. I'm never know when to use them or what my different states should be.

 

I've done a lot of reading, but I'm still not sure what states I need for my application. I have one instrument I want to read temperatures from ever few seconds, nothing else (does this even need to be in the state machine?). The 340 I want to read a few different variables from in a particular order every few seconds, and occasionally (once a day maybe) I want to briefly stop reading data from it so I can write commands to it to change various settings, then I want it to go right back to reading the data every few seconds in a particular order. I write all the data to a spreadsheet.

 

As previously stated, I use a case structure and flat sequence structure to accomplish this (with occasional hiccups). How do I get started converting to a statemachine? 

0 Kudos
Message 5 of 6
(1,535 Views)

@GerdW

 

I did as you had explained and setup a statemachine, with different states being different commands and I can get the data i need and plot it on a chart, so that is some success.

 

I'd like to write the data from every state to a single spreadsheet but I'm not sure how to accomplish that. How do I gather all the data so I can write it to a spreadsheet?

 

Thank you for your help!

0 Kudos
Message 6 of 6
(1,520 Views)