LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed daqmx task - Help!

Solved!
Go to solution

I am coding in LabVIEW itself and by "balance" i meant a mismatch between the task and data channel(as you mentioned). 

 

I got rid of the 200086 error but the 200524 error still persists. 

 

Right now my task is a Single channel - 1D U16 digital out. So, in order to match the number of channels in my task, what data task configuration do i use? 

 

Additonally, Currently, I am wiring an integer constant(which represents the respective channel in decimal) to the Write task. However, when i change 1D U16 to Multiple channel - 1D u 16, it does not let me wire an integer to the task anymore as i need an array. 

 

" You need to make sure the size of the array you write matches the number of channels you defined in the task" - How do i achieve this? 

 

Thanks, 

RP.

0 Kudos
Message 11 of 19
(1,039 Views)

It would be easier to pinpoint the problem, if you post your code (if it is possible, not a picture, but a snippet or VI).

0 Kudos
Message 12 of 19
(1,027 Views)

I will. 

0 Kudos
Message 13 of 19
(1,024 Views)

@RandelPrandel wrote:

I am coding in LabVIEW itself and by "balance" i meant a mismatch between the task and data channel(as you mentioned). 



I meant language as English vs. something else.  The word "balance" doesn't show up in the description I see for that error number, and isn't really the correct word to use for the situation that the error describes for the mismatch between the number of channels in the task vs. the data.

 


@RandelPrandel wrote:

 

Right now my task is a Single channel - 1D U16 digital out. So, in order to match the number of channels in my task, what data task configuration do i use? 

 

Additonally, Currently, I am wiring an integer constant(which represents the respective channel in decimal) to the Write task. However, when i change 1D U16 to Multiple channel - 1D u 16, it does not let me wire an integer to the task anymore as i need an array. 

 

" You need to make sure the size of the array you write matches the number of channels you defined in the task" - How do i achieve this? 

 

Thanks, 

RP.


 

I don't deal with digital outputs hardly ever, and they have a bit more complication since you may or may not (depending on the device) be able to write to individual digital output pins  (lines), or you might have to write to a whole group of pins at once (a port).  And then whether the data you send is based on a boolean (True/False) or an array of booleans, or has integers where the binary value of the integer determines which lines are on or off.

 

Definitely attach your code so we can see what you are doing.  Are you using "port format"?  Are you trying to use the single sample outputs or multiple sample outputs?

 

To compare the situation to an Analog Write, if you are doing 1 channel 1 sample, you'd send a single scalar value.  If you were doing 1 channel multiple samples, you'd either send a waveform, or a 1-D array where each element in the array represents a different point in time.  If you were doing N channel 1 sample, you'd send a 1-D array where each element represents a single value going to each of the channels.  In that case if your task was defined with X channels, you'd have to send a 1-D array with exactly X elements.  Any more or any less would cause an error.  That is basically what your second error means.  It is similar for Digital outputs, but without knowing exactly how your task is defined, and the fact that digital output tasks have several more options, it is difficult to say exactly how you should be doing this.

0 Kudos
Message 14 of 19
(1,001 Views)

This is a guess at the problem, since I don't have the hardware nor its manual to check.  I understand that the code works fine for one module, and I'm guessing you are doing a Port Write using a U16 input.  But when you try to do all three modules, it fails.  It sounds like it wants a 1D U16, that is, an array of values, possibly one per module.  Does that sound right to you?

 

Bob Schor

0 Kudos
Message 15 of 19
(981 Views)

@Bob_Schor wrote:

This is a guess at the problem, since I don't have the hardware nor its manual to check.  I understand that the code works fine for one module, and I'm guessing you are doing a Port Write using a U16 input.  But when you try to do all three modules, it fails.  It sounds like it wants a 1D U16, that is, an array of values, possibly one per module.  Does that sound right to you?

 

Bob Schor


Don't guess

 

For the hardware mentioned there can be only 1 DO task on the chassis.  The Task CAN have all 12 relay channels in it.  (up to 16 actually if all slots are used but 3 were specified)  The task cannot have multiple samples per channel (SPST Relays - yes, Relays with armatures that move!)

 

So the correct poly instance for DAQmx write would either be 1D Bool (with up to 12 elements) or a 1D integer (2 U8s or 1 U16 element(s))  A single element U32 array would work too but only the lowest 12 bits could possibly be used.   


"Should be" isn't "Is" -Jay
0 Kudos
Message 16 of 19
(971 Views)

@JÞB wrote:

Don't guess

   


Boy, are you tough!  I was just indulging in the old practice of "Answer Analysis", namely why would you configure a 1D U16 for a digital device?  Of course, another (reasonable) possibility is that the 1D refers to time, not channels, but I left my Thinking Cap home, needing my wool hat in our current Single Digit temperatures ...

 

BS

Message 17 of 19
(960 Views)

Hello Guys,

 

Please find attached the vi. 

 

 

 

Thanks, 

RP. 

 

0 Kudos
Message 18 of 19
(956 Views)
Solution
Accepted by RandelPrandel

Lets take a snip of one section fixed up a bit:

Capture.PNG

You have twelve channels you must use a multiple channel write- you had a scalar U16 so I chose the 1D U16 instance, Built the array with the one element of "1021" you had and change the displat of that constant to Binary with a minimum field width of 12, 0 padded (easier to tell what bits are set that way)

 

Rinse and repeat for the rest.

 

Now lets talk about that nasty abuse of the event structure.  Its not very clean and you need to go and read up on 

"Producer Consumer (Events) Design pattern"  and "State Machine".

 

You users will thank you for watching that video.


"Should be" isn't "Is" -Jay
0 Kudos
Message 19 of 19
(943 Views)