Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

NI9476 does not output correctly in a subvi

Solved!
Go to solution

Attached VI "Outputs not correct" is a very small section of a larger program. I have 3 NI9476 that I am setting the outputs on. I made an array with 3 bits that walk thru the 32 bits for each module by incrementing the step (from 6 and up). The 1st module is shown in the VI. For the 2nd 2 I created a subvi (Digital Outputs) so I could expand them to as many modules as needed without taking up a lot of room.

 

When you run the program, the black dots indicate what bits should be set on each module. The problem is the outputs from the NI9476 that are in the subvi's are not correct. What am I doing wrong?

 

If I remove the subvi and make the 2nd 2 the same as the 1st - they all works ok.

 

I did do the HotFix 384042 but that made no difference.

Download All
0 Kudos
Message 1 of 13
(4,553 Views)

I've been playing with your VIs and I can't find anything about the 1st section of code in the main VI vs the subVI that works differently. I get exactly what I expect when I change the data input in the DO array for all three rows. When you do it, do you see the issue in the data Output indicator (wrong values here) or is it a matter of the actual outputs from the NI 9476 that are wrong?

0 Kudos
Message 2 of 13
(4,536 Views)

Yes, It's just a matter of the outputs being wrong - not matching the digital indicator.

 

I also found if I saved 1 of the subvi's as a different name - then they work ok. A reentrant problem?

 

Thanks,

 

0 Kudos
Message 3 of 13
(4,534 Views)

It definitely sounds like a reentrant problem since it works fine if you're calling separate VIs. My only question is whether or not this is expected behavior. I'm going to try and figure that out.

0 Kudos
Message 4 of 13
(4,523 Views)

Is the incorrect data you're getting completely random? or is it copies of the data from one of the other reentrant VIs? Also, how are you reading the data from your 9476 to know when it's right or wrong?

0 Kudos
Message 5 of 13
(4,521 Views)

The way I tested this VI is to select a step (say 9) and run it - then measure the outputs with a DVM. For step 9 I expect 24 Volts where the black is indicated on the front panel. Bits 2,3 & 4 for the 1st module, bits 1,2 & 3 for the 2nd module, and bits 0,1 & 2 for the 3rd module.

The 1st and 2nd module measure as expected , but the 3rd module has no outputs set or  whatever bits were set before the program was run. Basically the output does not change.

0 Kudos
Message 6 of 13
(4,518 Views)

Sounds like the second subVI might not even be running. Do you know if it is or not? Have you set these VIs to be reentrant?

0 Kudos
Message 7 of 13
(4,516 Views)

I have not set the VI to be reentrant - have not found that setting yet. It is whatever the default is when you create it.

 

Does it run - not sure? I have put debug points and probes - every looks like I would expect.

0 Kudos
Message 8 of 13
(4,509 Views)

Ok, I think you should try setting the VI to reentrant and see what happens then. To do this, open the subVI and right-click the icon on the top. Select VI Properties. Within the dialog box that pops up, choose "Execution" as the category and check the checkbox for Reentrant execution.

0 Kudos
Message 9 of 13
(4,507 Views)

OK, setting the vi to reentrant fixed my issue in my main program. That brings me to the 2nd issue I am having. In the test VI I sent, the 2nd called VI  (32 Bit Digital Output) Do2 Name is fed with a property node value.  Sometimes it seems the value passed to the VI is blank and there is an error displayed in error out. Is there a better way to feed the same name to multiple places(I'm only showing 1 here) that will work?

0 Kudos
Message 10 of 13
(4,499 Views)