LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx pin out

Solved!
Go to solution
Solution
Accepted by topic author jm56789

You can send one voltage to one channel and a different voltage to a different channel all at one time, or at any time you specify.  Try it.  Look for examples on analog output.  Try writing some code and then post it here when you run into problems.

- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 18
(1,495 Views)

Hi, how would the enclosed VI works to read quadrature encoder, 2 channels A and B, and if channel B mis wired or in place of Wire A the encoder would decrement instead of increment. I am not sure how to wire the False cases. The VI has broken line. Any help to fix the enclosed VI.

Regards;

JH

0 Kudos
Message 12 of 18
(1,473 Views)

To make it work with two inputs, you have to specify two inputs.  Your Digital Lines control only take in one input.  You can create a string control and list the two input channels separated by a comma, and wire the string control into the DAQmx Create function instead of the Digital Lines control.  This will set up a task using two channels.  Then in the DAQmx Read, you have to select Multiple Channels Single Sample - 1D Boolean.

 

I'm not sure what you are asking when you say if channel B is mis-wired.  What are you not sure about when wiring the False case?  Which false case?

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 18
(1,462 Views)

Thanks Bob,

I did try your recommendations and the VI worked only in the negative count. I would like to be able to read  the positive direction or count up. The VI should read positive count if the encoder is wired correctly, CH A wired to Pin 1 on the connector and to read CH B from Pin 2 on the connector.

And if CH A is wired to Pin 2 instead of Pin 1, it should count down or negative count.

Regards;

Jh

0 Kudos
Message 14 of 18
(1,453 Views)

I don't know the logic behind your objective, but you do.  You should trace through your code to figure out why it never counts up.  Use the light bulb.  Watch the data flow.  You probably have some of the next state being set wrong. 

 

It looks like the only way to count up is for the current state to be AlowBhigh.  This gets set when the DAQ input 1 is False, no matter what input 2 is, according to your code's logic.  I think your logic is faulty.  You will never get AlowBlow as your next state because if input 1 is false, the output of the AND will always be false, and AlowBlow will never be selected.  You need to re-visit your logic.  You don't need the AND gate inside a case because you already know what state the input 1 is, and you've made a selection on this input with the case structure.  Just select on input 2 alone inside the case.  Fix your logic.

- tbob

Inventor of the WORM Global
0 Kudos
Message 15 of 18
(1,446 Views)

Hi Bob,

Thanks for your help.

the logic behind my test is to test an encoder. Assemblers, in some cases, they wire CHA to pin 2 on the connector instead of pin 1. Under this situation, the system will turn CCW instead of CW.

The encoder has two channels, A and B

output of encoder is

A: 1  1   0   0

B: 0  1   1   0

I managed to have it working. Now, my assignment is to modify the VI and to read how many counts in one reveloution. Usually the encoder count is 256 in one revelution. Any idea how to modify the enclosed VI to read the encoder count. It is a quadrature signal, 4 segments in one wave from, CH A leads CH B by 90 degrees.

Regards;

JH

 

0 Kudos
Message 16 of 18
(1,421 Views)

I'm sorry but I don't know anything about your hardware.  Your logic still looks funny.  I suggested that you change the way the cases work and you have not done so.  Still you have the condition if the input to the top loop is false, inside the false case, the top selection will never be taken because the output of the AND will always be false.  Look at the InitialRead case.  If A is lo, it doesn't matter what B is, your AND gate will always be false and the next state will be ALoBHi, even though B may be Lo.  ALoBLo will never be selected with your logic.  I don't think this is right.  If both inputs are low, don't you want your next state to be ALoBLo?  It will never happen.

Use this nested case structure to select the next state:

 

21806iCBCA051A571A99A1  In inner False case, the selection is AHiBLo.  In outer False case, ALoBHi and ALoBLo is used.

 

For counting, what do you want to count?  You code makes no sense.  In the AHiBLo case, you increment if the last state was AHiBHi.  What does this mean?  Please give a better explanation.

 

What version of Labview are you using?

- tbob

Inventor of the WORM Global
0 Kudos
Message 17 of 18
(1,415 Views)

Thanks Bob, I will update according to your recommendation.

I am using Labview 2009.

I am counting the encoder output, it outputs 256 pulses per one revolution.

Regards;

JH

0 Kudos
Message 18 of 18
(1,391 Views)