LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Physical channel as controls don't seem to update properly

I have a PXI-1033 chassis with a PXI-4461 (2-Input/2-Output). I will generate a signal on an output and acquire the signal on an input. I would like to do this twice on two separate sets of physical channels. I used the DAQ Assistant to generate code and tested it and it worked fine. I then choose Open Front Panel and the only change I made was to turn the physical channel constants into controls instead. I then use this VI as a sub-VI and I call this sub-VI twice with different physical channels. I can see the controls in the sub-VI being properly updated, but my signal is always generated and acquired on the physical channels I used in the first call to the sub-VI. What am I missing here, why don't the physical channels update? Please keep in mind I am a beginner LabVIEW programmer.

0 Kudos
Message 1 of 10
(3,974 Views)

Can you post your VI so that we can see whats going wrong with the program?

 

Regards,

Andy

0 Kudos
Message 2 of 10
(3,957 Views)


@arnold_w wrote:

I used in the first call to the sub-VI. What am I missing here, why don't the physical channels update? Please keep in mind I am a beginner LabVIEW programmer.


Since you use the first call to the SubVI, the physical channels wont get updated, when your MainVI calls the SubVI again.

First call will become null & void only when that instance of LV is closed or the application is closed.

We encountered this kind of problem just a few days ago.

Maybe you can have a look at the VIs attached.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 10
(3,947 Views)

Partha:
It seems to me that you have encountered exactly the same problem as I have. Have you been able to find a workaround, except having two almost identical VI's where only the physical channel differ? In the VI's you attached there is a lot of information for a beginner LabVIEW programmer, what part(s) should I focus on?

Andy:
Please see Partha's VI's, he seems to have had the same problem as I am having.

0 Kudos
Message 4 of 10
(3,940 Views)

In my VI, the Physical Channel assignment is done in the code itself by way of constants wired to the terminals.

If you want to pass them from the FP {Front Panel], you ve to create 2 controls for them. This can be done in the BD [Block Diagram] itself.

See the pics attached. I ve put comments for what needs to be done.

Try this & feel free to post here if you ve further doubts.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 5 of 10
(3,934 Views)

Thanks for your suggestions, but I'm not sure how to apply it on my project. My project looks like this:

In order to generate the last VI (DAQ_Assistant_Generated_Code.vi) I used the DAQ Assistant and then chose Open Front Panel and turned the physical channel constant into a control instead. I then added that control to the connector in the Front Panel. I would expect to first see a 5 second long sine wave on PXI1Slot2/ao0 and then a 5 second long sine wave on PXI1Slot2/ao1, but instead I see a 10 second long sine wave on PXI1Slot2/ao0. How should I alter my VI's to make it work? I have attached my VI's.

0 Kudos
Message 6 of 10
(3,923 Views)

Hi Arnold,

I can now see where the problem is occuring with your VI's. In the DAQ Assistant Generated Code VI, where you assign the physical channels to the AO Voltage task ie: the 2nd Case structure, there is the 'First Call?' symbol on the input of the case structure. On the first call to this VI, everything will work fine, but on the 2nd call, the Case structures will exectue the 'False' case, which doesn't re-assign the physical channels to the task, instead using the channels from the previous iteration.

It's an easy problem to fix, simply remove the case structure from this, and the subsequent, sections of the program, and everything should work as you'd expect. I would keep the 'First Call?' case structure in the section where the task is initially created so you don't have to create a new task for every call to the VI.

Hope this solves the problem.

Regards,

Andy

0 Kudos
Message 7 of 10
(3,900 Views)
Also, you can simply go on replacing the First Call function with a True constant. Smiley Wink
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 8 of 10
(3,885 Views)
I meant all the First Call functions...
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 9 of 10
(3,884 Views)

I have now changed my VI like this:

When I run it, it works fine for five seconds, then I get the following error message:

What did I do wrong? The new VI is attached.

0 Kudos
Message 10 of 10
(3,874 Views)