05-10-2021 02:26 AM - edited 05-10-2021 02:29 AM
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…
05-10-2021 02:47 AM
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.
05-10-2021 05:25 PM
@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.
05-11-2021 02:36 AM
@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.
05-11-2021 02:41 AM
@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...
05-11-2021 05:11 AM
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.
05-11-2021 05:18 AM
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+.
05-11-2021 07:20 AM
@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.
05-11-2021 09:02 AM
@aerosimon wrote:At the moment I'm a bit confused. It's about molbox 1+.
So are we.
Post some code.
05-17-2021 01:06 AM
Do you mean that the answers must all be different? This is indeed my case, I'll look into it thanks.