LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA and READ function - Problem linked to the bytes at port

Yet something must be different.  Try logging every response you get.  Try using NI's I/O trace to inspect what is actually being returned from the serial port.  Just because the device's manual says nothing is different about that command and response doesn't mean the hardware guys actually programmed the device according to what the manual says.

0 Kudos
Message 101 of 114
(301 Views)

You can additionally stick probes on the wires in the problem areas.  Like the output of the reads in question.  (i.e., the reads after the CC and CS commands.)

 

[edited for clarity]

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 102 of 114
(302 Views)

I've done all of that already, and I Just get (sometimes, not always) the response of the CC command after the WRITE function calling for the CS command. The returned string is exactly what a CC command would send back.

0 Kudos
Message 103 of 114
(295 Views)

@RavensFan wrote:

Yet something must be different.  Try logging every response you get.  Try using NI's I/O trace to inspect what is actually being returned from the serial port.  Just because the device's manual says nothing is different about that command and response doesn't mean the hardware guys actually programmed the device according to what the manual says.


Wouldn't it be interesting to find out that the firmware is incorrectly treating both commands as "CC"?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 104 of 114
(294 Views)

gnore my last reply - it was made before you noted it was intermittent.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 105 of 114
(292 Views)

The CC command always returns the appropriate data?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 106 of 114
(291 Views)

@ICCR-Lab wrote:

I've done all of that already, and I Just get (sometimes, not always) the response of the CC command after the WRITE function calling for the CS command. The returned string is exactly what a CC command would send back.


When you get the CC response following the CS command, what did you get for the CC response immediately after the CC command?  The same thing?  Nothing?  An error?  A timeout error?  Something completely different?

0 Kudos
Message 107 of 114
(286 Views)

So. I'll try to be as clear as possible. 

 

As the error is intermitent is quite hard to spot it, especially when I don't know what triggers it.

BUT:

From my snippets you can see that I've got a gauge for the pump brine controller. I think the gauge sometimes goes to zero then immetdiately back to the current pressure. My guess is:

 

- step 1) the CC command is written/read nicely

- step 2) the priming is done (nicely or not, whatever) and then I run my backpressure regulator and the cp pump. as the CS command is the last one interpreted (if I didn't set any new values), the flow rate is kept somewhere into the buffer and will be later read by the CC command of the gauge ( I think that as the response of the CC command is  OK, pressure, Flow rate/ where the CS is OK, flow rate, etc.)

 

It's a guess.

 

Flo

 

0 Kudos
Message 108 of 114
(283 Views)

@ICCR-Lab wrote:

So. I'll try to be as clear as possible. 

 

As the error is intermitent is quite hard to spot it, especially when I don't know what triggers it.

BUT:

From my snippets you can see that I've got a gauge for the pump brine controller. I think the gauge sometimes goes to zero then immetdiately back to the current pressure. My guess is:

 

- step 1) the CC command is written/read nicely

- step 2) the priming is done (nicely or not, whatever) and then I run my backpressure regulator and the cp pump. as the CS command is the last one interpreted (if I didn't set any new values), the flow rate is kept somewhere into the buffer and will be later read by the CC command of the gauge ( I think that as the response of the CC command is  OK, pressure, Flow rate/ where the CS is OK, flow rate, etc.)

 

It's a guess.

 

Flo

 


Thanks for being so specific.  It really helps.  (Not that you weren't trying to be clear earlier.)  It's like being a detective.  The more questions you ask, the clearer the issue becomes until the mystery is solved.

 

In step 2, are you actually saying that the format of the response is correct, but the value of the flow rate is incorrect?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 109 of 114
(279 Views)

@ICCR-Lab wrote:

So. I'll try to be as clear as possible. 

 

As the error is intermitent is quite hard to spot it, especially when I don't know what triggers it.

BUT:

From my snippets you can see that I've got a gauge for the pump brine controller. I think the gauge sometimes goes to zero then immetdiately back to the current pressure. My guess is:

 

- step 1) the CC command is written/read nicely

- step 2) the priming is done (nicely or not, whatever) and then I run my backpressure regulator and the cp pump. as the CS command is the last one interpreted (if I didn't set any new values), the flow rate is kept somewhere into the buffer and will be later read by the CC command of the gauge ( I think that as the response of the CC command is  OK, pressure, Flow rate/ where the CS is OK, flow rate, etc.)

 

It's a guess.

 

Flo

 


Are you checking the VISA Read for any errors?  It sounds to me like you are sending the command, it is executing, but you might be getting a timeout error when the response to the command isn't coming back in time before the VISA Read executes.  Perhaps the priming function takes a little longer and only responds when it is done.  When you get the timeout error, you have no response which gets intepreted as zero.  Then when you get to executing the next command, the response to the first command as finally reached the serial buffer and you read it instead.  The response to your second command will be sitting in the buffer waiting on the next VISA read.

 

You don't want to just flush things.  You need to figure out what is going on and fix it.  Perhaps a longer delay between the prime command and reading the response.  Or allow for several retries of the VISA Read for that response until you get a valid response.

0 Kudos
Message 110 of 114
(263 Views)