Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

two counter inputs and counter output NI 9401

I am trying to configure two counter inputs and one counter output on one NI 9401. I have looked and found how to configure digital lines in booth directions but it seems like I can only do two counters in all on one module. Can someone verify this for me or let me know how to get all three on to one module?

 

Thank you

0 Kudos
Message 1 of 16
(13,369 Views)

Hi mschoenwald,

 

The counters are actually located on the backplane of whatever chassis you are using--I'll assume you are using cDAQ and not cRIO.

 

  • If you have the older <link no longer exists>, then there are only 2 counters available in general.  You can access both from a single parallel (8 lines or less) digital module in slot 5 or 6 of the chassis.

  • The 2nd generation Compact DAQ chassis (including 9174, 9178, 9181, 9188, etc.) includes 4 counters.  You may access them from any slot with a parallel module.  There is no restriction preventing you from accessing all 4 simultaneously from a single module.

 

The 9401 is bi-directional and configurable by nibble (line0:3 may be configured one direction, and line4:7 another).  However, it is quirky in that it requires the line direction to be configured before any of the tasks are started.  This is because the data lines themselves are used to set the line direction behind the scenes.  The best way to work around the behavior is to use DAQmx Control Task to explicitly reserve your tasks before any of them are started (see here).  Keep in mind that the counter output should use the opposite nibble from the two counter input tasks.

 

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 16
(13,365 Views)

Thank you for the respose.

 

I am using the 9178. I am a little confussed as to how this is done. The pin out has the counters overlapping. Are you able to show me a simple snippet of code that would set up 1 PWM output, 1 PWM input and 1 frequency counter on a single module. Also any info on the wiring for this would be helpful.

 

I have the output task setup and wired on ctr0 but have not got the others working yet.

0 Kudos
Message 3 of 16
(13,356 Views)

Hi mschoenwald,

 

The default pins might overlap, but you can specify to use whichever PFI line you want for the counter tasks using property nodes.  Depending on the task type, you would need to select a different property.  For example:

 

2011-06-15_094604.jpg 

 

 

Once you put the corresponding property node in each task you may set whatever PFI line you wish (just make sure the inputs and outputs sare on separate nibbles).  You should still reserve all your tasks before starting them so the hardware is able to set line direction before the tasks are running.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 16
(13,350 Views)

Hi,

 

I am currently having the same issue with the same equipment.  I have the NI9401 hooked up to the slot 6 of a NI cDAQ-9178.  I am trying to create an input counter (for an angular encoder), as well as use one of the digital outputs (like PFI6) to trigger an external device.  I am using the DAQmx blocks and can't seem to reserve the lines properly. 

 

I have attached my VI, if you can help at all it would be greatly appreciated.


Thanks,

Nick

0 Kudos
Message 5 of 16
(13,308 Views)

Hi,

 

I am currently having the same issue with the same equipment.  I have the NI9401 hooked up to the slot 6 of a NI cDAQ-9178.  I am trying to create an input counter (for an angular encoder), as well as use one of the digital outputs (like PFI6) to trigger an external device.  I am using the DAQmx blocks and can't seem to reserve the lines properly. 

 

I have attached my VI, if you can help at all it would be greatly appreciated.


Thanks,

Nick

0 Kudos
Message 6 of 16
(13,303 Views)

Nick,

 

As John said in his post, you need to set the PFI line that you want to use. I added it to the vi but you need to change the property as I don't have the module here anymore.

 

Mark

0 Kudos
Message 7 of 16
(13,289 Views)

Ok thanks.

 

 I was trying different combinations of it all yesterday and I couldn't figure out which property to use since its a digital output.  Right now the property is set to Counter Input, frequence, input terminal.  I'm guessing that I need Counter Output, pulse, output terminal?  

 

The other question i had was whether or not I should have them in a sequence structure, and if so, which process should go first (line reserve or the property node)?

 

 Also to make things more complicated, I'm going to be attaching external signals to two input counterss and two output counters, do you know if this is possible?

 

Thanks for the assistance,

Nick

0 Kudos
Message 8 of 16
(13,287 Views)

Hi Nick,

 

You said that you "can't seem to reserve the channels properly".  Were you seeing specific behaviors or error messages when you ran your code?  If so, could you tell us what they are?  I would recommend trying to reserve all the tasks instead of just the counter input task and see if that has any effect on the issue.

 

Also, the counter input/output terminal properties apply only counter input or output tasks and won't work for digital tasks.

 

Thanks,

Joe S.

0 Kudos
Message 9 of 16
(13,279 Views)

You can only have a total of four counters for the chassis. So if you are planning to add two more inputs counters and two more output counters to the existing counter for the encoder it won't work.

0 Kudos
Message 10 of 16
(13,264 Views)