12-02-2011 10:56 AM - edited 12-02-2011 11:01 AM
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.
Solved! Go to Solution.
12-05-2011 02:18 PM
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?
12-05-2011 02:22 PM
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,
12-06-2011 09:20 AM
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.
12-06-2011 09:38 AM
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?
12-06-2011 10:47 AM
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.
12-06-2011 11:03 AM
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?
12-06-2011 11:51 AM
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.
12-06-2011 12:02 PM
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.
12-07-2011 03:59 PM
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?