Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Quadrature Counters 9401 and 9174 chasis

Can a single 9401 digital IO board be connected to more than a single counter (for quadrature decoding) in a 9174 chasis using Measurement Studio (not Labview VI) and  ContinuousInputDaqComponent "component" (mxb) model? When I create a second component I get  an Initialization Error (Device cannot be configured for input and output because lines and/or terminals on this device are in use by another task or route.  ... Status Code: -201133

 

I tried moving the PFIs around with no success. Added Reserve code to Task with no success as well.  This is a 1 Sample (On Demand) MXB generated component model.

 

If there is an example of multiple decoder code (in C#, C++ or ever VB) somewhere not using the component model

 

Snippet Below:

 

            myLinearEncoder = new MotorLinearEncoderComponent();
            myLinearEncoder.TaskReserve();
            myLinearEncoder.TaskCommit();
 
            myLinearEncoder.DataReady += OnLinearEncoderCounterDataReady;
            
            myRotaryEncoder = new MotorRotaryEncoderComponent();
            myRotaryEncoder.DataReady += OnRotaryEncoderCounterDataReady;
 
            myLinearEncoder.StartRead();   <--- fails here
            myRotaryEncoder.StartRead();


0 Kudos
Message 1 of 2
(4,309 Views)

Never mind. The reserved task needs to be started last thus the following works:

 

            myLinearEncoder = new MotorLinearEncoderComponent();
            myLinearEncoder.TaskReserve();
 
            myLinearEncoder.DataReady += OnLinearEncoderCounterDataReady;
            
            myRotaryEncoder = new MotorRotaryEncoderComponent();
            myRotaryEncoder.DataReady += OnRotaryEncoderCounterDataReady;
            myRotaryEncoder.StartRead();
 
            myLinearEncoder.StartRead();

and in user code for component

        public void TaskReserve()
        {
            Task.Control(TaskAction.Reserve);  //locks GPIO
        }
0 Kudos
Message 2 of 2
(4,293 Views)