06-25-2014 02:45 PM
Have a single devicel, a USB-6343 here and 4 Vis running as seperate executeables.. but they all need different channels off that device (D I/O, AI/O, counters). This works except when it gets to the analog inputs. I sort of aware that due to the single ADCs, you can't have multiple tasks doing the analog inputs. When I was doing a single Vi, I made a single task that polled NChan1Samp , and then unpacked the cluster and used them for various purposes. It sort of skipped my mind when I ran multuple copies of this Vi , it wouldn't work.
My first attempt at getting around this was creating a DAQmx Task in NI Max that would pull 6 analogs, and change the VIs to each read from this DaqMx Task, but be concerned with different indexes. That failed.. same results as if i had different threads directly trying to access the analogs (1st one gets it, rest done).
Is there something else I can try? I have thought I could make a dedicated Vi that becomes a server for the analogs via shared variables? Anything simpler than this? I haven't used the shared variable thing yet so would have to figure that out first.
06-25-2014 03:57 PM
Create one process that reads all the data an publishes it to the 3 consumers using a user-defined event (UDE). Sort of a producer-consumer pattern but with three consumers and using an event rather than a queue.
When in a situation where you have multiple consumers that all need to see the same data, you need to use a UDE. A queue will divvy up the data so any one consumer will only get every third update.
Mike...
06-25-2014 04:01 PM - edited 06-25-2014 04:05 PM
That doesn't really let me jump .EXE files though right? My situation is I'm launching 4 instances of the same Vi in executable form. Each one, via .csv config file is looking at a different set of Analog inputs. However, because only 1 thread is allowed to talk to analog inputs as a whole due to a single ADC chip in the single USB DAQ.. I have to figure out how to share the hardware (ADC chip, not Analog channel). I thought making the task in NI Max that looks at all 8 analog channels, and then each VI.exe only looking at the channels they need from the NI MAX task (thus, only 1 task really accessing the hardware) would work.. but didn't.
06-25-2014 04:12 PM
Ok, if the separate processes are executables, substitute TCP/IP connection for UDE and carry on. There are some very good example for multi-connection TCP/IP shipping with LV.
Mike...