06-14-2011 09:50 AM
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
06-14-2011 06:21 PM - last edited on 11-04-2014 02:00 PM by C-T
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.
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,
06-14-2011 06:54 PM
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.
06-15-2011 09:49 AM - edited 06-15-2011 09:51 AM
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:
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,
07-12-2011 11:15 AM
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
07-12-2011 11:15 AM
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
07-13-2011 11:25 AM
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
07-13-2011 12:27 PM
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
07-13-2011 04:45 PM
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.
07-15-2011 10:17 AM
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.