From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffer reading, buffer de lecture

Hello, I am using labVIEW as part of an internship. I am working with the Molbox 1+ acquisition module, and I am trying to acquire data. There is a driver that I can't get to work, probably due to a lack of understanding of the tools specific to this driver.
I am trying to create a new one but I have the following problem:
(I work with a GPIB cable so it works with the VISA Write function, which "asks a question" and VISA Read which "gives an answer" this answer appears in a read buffer).
when I send several different questions in a row, the buffers do not necessarily send the answer they are supposed to send. They get mixed up with each other.
This means that when I use a specific scan string for an expected response, the program doesn't know how to respond.
Do you know if there is a way to impose a response order on the Buffer? I attach an example of a program with this problem.
Thank you in advance.

 

 

Bonjour, j'utilise labVIEW dans le cadre d'un stage. Je travail avec le module d'acquisition Molbox 1+, et je tente d'acquérir des donnés. Il existe un driver que je n'arrive pas à faire fonctionner, surement faute de compréhensions des outils propre à ce driver.
J'essaie donc d'en créer un nouveau mais j'ai le problème suivant:
(je travail avec un cable GPIB donc ca marche avec la fonction VISA Write, qui "pose une question" et VISA Read qui "donne une réponse" cette réponse apparait dans un buffer de lecture.)
lorsque j'envoie plusieurs questions différentes à la suite, les buffers n'envoient pas forcément la réponse qu'ils sont censés envoyer. Ils se mélangents les uns avec les autres.
Ce qui fait que lorsque j'utilise une chaîne de balayage spécifique à une réponse attendue, le programme ne sait plus répondre.
Sauriez vous si il existe un moyen d'imposer un ordre de réponses au Buffer ? Je vous joint un exemple de programme avec ce problème.
Merci par avance.

 

 

0 Kudos
Message 1 of 61
(5,176 Views)

@aerosimon wrote:

Do you know if there is a way to impose a response order on the Buffer? I attach an example of a program with this problem


Write the question, wait for an answer.

Write a new question, wait for an answer.

 

This is pretty standard, simply make a write and read VI, and use it for all queries. 

 

The alternatives are much harder. For instance, write all questions, and when parsing the results, link them to the questions. That's basically where you're at now. 

 

This might be more performant, as the device can execute them as it pleases. It usually doesn't make a significant difference, definitely not worth worrying about until you have to. 

0 Kudos
Message 2 of 61
(5,159 Views)

I need to have the different buffers written at the same time on the front panel. I am not sure what solution you are suggesting...

0 Kudos
Message 3 of 61
(5,129 Views)

Hi simon,

 


@aerosimon wrote:

I am not sure what solution you are suggesting...


The suggestion is: send one (1) request and wait for the response. Then you can send the next request…

 


@aerosimon wrote:

I need to have the different buffers written at the same time on the front panel.


It's not possible to read several responses "at the same time" as GPIB is a shared resource between several devices on the bus.

The devices also need to know how to handle several requests: most devices don't like that at all!

Best regards,
GerdW


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

@GerdW wrote:

Hi simon,

 


@aerosimon wrote:

I am not sure what solution you are suggesting...


The suggestion is: send one (1) request and wait for the response. Then you can send the next request…



Yes, and if you make a Write And Read.vi (don't make it reentrant!) you get this behavior automatically.

 

A (non-reentrant) VI can't execute twice at the same time, so if the front panel (?) triggers a write\read, it will never mix with another write\read.

 

If you have a Write VI and a Read VI (or even a write loop and a read loop), you'd have to force sequentially in a different way. 

0 Kudos
Message 5 of 61
(5,123 Views)

I don't understand the nuance of re-entrant or non-re-entrant, I put my different write and read loops in separate loops that are only supposed to start one after the other when the previous one is finished but the first buffer gives the answer to a question that is only supposed to happen after...
According to the manual of the tool I use, the TARE (this is an example) needs several "commands" before it can execute the TARE command itself. If I can only send one command at a time how can I use the TARE command?

 

0 Kudos
Message 6 of 61
(5,105 Views)

Hi simon,

 


@aerosimon wrote:

the TARE (this is an example) needs several "commands" before it can execute the TARE command itself. If I can only send one command at a time how can I use the TARE command?


You can execute each of those "several commands" one after the other: what's the problem to do so?

Best regards,
GerdW


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

I may not understand your question, but I think you want to send a series of commands to a device and display the response.

 

Try something like this:

 

loopCapture.PNG

 

If you need a delay between commands just add it to the loop

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 61
(5,050 Views)

It seemed like a very good idea but unfortunately my problem remains the same: the order of the table does not give the order of arrival of the answers.
I tried to put a table on the front so that all the answers are on the front side, and this is how I see the incoherent order of my answers.
In what form can I attach my programme so that you can access it?

0 Kudos
Message 9 of 61
(5,033 Views)

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?

 

0 Kudos
Message 10 of 61
(5,030 Views)