LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffer reading, buffer de lecture

Hi Simon,

 


@aerosimon wrote:

To perform this TARE, I have to ask several questions to the device
TARESET UP = UP
TARE
TARESET
each of these questions awaits an answer.
In order to process these responses, I need to know which read buffer to process at the time of the response. But the different answers arrive in the read buffers without any order, or recurrence. This makes it impossible to process the data.


Can you execute the example VI given by RTSLVU (simple FOR loop autoindexing the command string array) and show us the answers you get from each request?

 


@aerosimon wrote:

In what form can I attach my programme so that you can access it?


You should attach as VI. (Or your complete project folder as aZIP.)

It also helps when you run your VI until you get some useful data in all indicators, then set all values to default (edit menu!), then save the VI, then attach it: this way we can also examine the data you see in your VIs…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 11 of 61
(4,215 Views)

I will give you once more the same suggestions you already received.

If an answer is foreseen for each command, the best way to go is send a command and wait for the answer before sending the next.

This will be much easier to manage and will only cost a (usually) small additional delay in your program.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 12 of 61
(4,211 Views)

@aerosimon wrote:

I explain in the form of my current example:
I have to do a TARE.
To perform this TARE, I have to ask several questions to the device
TARESET UP = UP
TARE
TARESET
each of these questions awaits an answer.
In order to process these responses, I need to know which read buffer to process at the time of the response. But the different answers arrive in the read buffers without any order, or recurrence. This makes it impossible to process the data.
Have I made myself clearer?

 


 

 

Well see there's your problem, you should only have ONE "read buffer".

 

It's not impossible, just not simple...

 

So if you have to wat for a certain response, then wait for it...

 

Check the response you receive and see if it equals any of the three you are expecting. 

 

If it does then set a Boolean to keep track of the received responses.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 13 of 61
(4,197 Views)

@aerosimon wrote:

In what form can I attach my programme so that you can access it?


Ideally, a VI, multiple VIs, or a zip of the VIs\project.

 

Alternatively, for small illustrative purposes, an image embedded (not attached) in the post. This image can be a snippet.

0 Kudos
Message 14 of 61
(4,185 Views)

@aerosimon wrote:

I explain in the form of my current example:
I have to do a TARE.
To perform this TARE, I have to ask several questions to the device
TARESET UP = UP
TARE
TARESET
each of these questions awaits an answer.
In order to process these responses, I need to know which read buffer to process at the time of the response. But the different answers arrive in the read buffers without any order, or recurrence. This makes it impossible to process the data.
Have I made myself clearer?

 


Either the messages are synchronous (one in, one out), or they are not.

 

If they are, send\receive, everything should be dandy.

 

If they are not, you should be able to send one message, wait for the answer, send the next.

 

Even if, for instance, the replies are delayed and then send after the 3rd command (very unlikely, but let's go with it) and the replies come in 'randomly', there won't be a solution, except to somehow correlate them to the send commands. If there's no correlation, well, nothing can be done really. 

 

I'm getting curious about the code...

0 Kudos
Message 15 of 61
(4,182 Views)

Hey, thanks for answer 

what do you mean by If it does then set a Boolean to keep track of the received response? I don't understand. 

0 Kudos
Message 16 of 61
(4,186 Views)

Okay, thank you.
If you're curious, this is a code that relies on very specific commands that have their own operation. 
At the moment I'm a bit confused. It's about molbox 1+.

0 Kudos
Message 17 of 61
(4,184 Views)

@aerosimon  ha scritto:

Hey, thanks for answer 

what do you mean by If it does then set a Boolean to keep track of the received response? I don't understand. 


Here is an example. This code only works if there are no identical expected answers.

searchansw.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 18 of 61
(4,173 Views)

@aerosimon wrote:

At the moment I'm a bit confused. It's about molbox 1+.


So are we.

 

Post some code.

0 Kudos
Message 19 of 61
(4,162 Views)

Do you mean that the answers must all be different? This is indeed my case, I'll look into it thanks.

0 Kudos
Message 20 of 61
(4,134 Views)