LabVIEW为什么NI 6602的两个计数器中只能有1个工作
问题: 在使用PCI-6602的两个计数器,不过看起来只有一个在工作,请问该如何解决这个问题?
解答: 产生这个问题可能是因为在设置计数器的时候没有指定计数器组(counter group)。E系列的数据采集卡和基于NI-TIO的板卡(例如PCI-6602)不支持多个计数器的组,因此,需要设置每个计数器为一个单独的组。如果不为每个计数器设置单独的组,那么,当为下一个计数器调用Counter Group Config,vi,就会覆盖前面一个计数器的信息。
例如:
想设置两个计数器(0和1),用Counter GroupConfig.vi 来配置计数器0,但是,没有配置计数器组,因为这是个选用的输入。正因为没有设置计数器组,所有计数器0被默认放置在0组。
如果要调用CounterGroup Config.vi再来配置计数器1,并且也没有配置计数器组。不能在同一个计数器组中有。
多于一个计数器,因此当计时器1默认配置为计时器组0,这样将替换掉计数器0的信息。因此,虽然配置了计数器0和计数器1,只能使用计数器1。
解决方法是给“countergroup”输入端指定值,给每个计数器分配不同的计数器组(从0开始,按1递增)。
I wantto measure frequency, period, pulse width, semi period, two edge separation,position, velocity, duty cycle, or count edges
with myNI hardware. How do I wire up or connect my encoder to a counter?
Theencoder has five outputs: Channel A Out, Channel B Out, Channel A Inverse Out,Channel B Inverse Out and Z-Index.
Connectingthe encoder to a single counter:
1.Choose Channel A and Channel B or Channel A Inverse and Channel B Inverse. Donot connect a non-inversed and an inversed
channelto the same counter. For example, Channel A Out and Channel A Inverse Outshould not be connected to the same
counter.
2.After selecting a valid pair of inversed or non-inversed channels, make one ofthe following connections configurations
dependingon the channel pair selected:
Configuration1
ChannelA to Source
ChannelB to AUX
Z-Indexto Gate
Configuration2
ChannelA Inverse to Source
ChannelB Inverse to AUX
Z-Indexto Gate
An easyway to find the pin connections to these counters is to right click the devicein Measurement & Automation Explorer (MAX)
andselect Device Pinout.
Connectingthe encoder to two counters:
In somecritical applications, a single encoder is connected to two counters to keeptrack of precise counting. To do this, make the
followingconnections:
1.Connect the non-inversed pair of channels and the Z-Index to Counter 1 inConfiguration 1 above.
2.Connect the inversed pair of channels and the Z-Index to Counter 2 inConfiguration 2 above. The Z-Index is connected to both
counters.
AdditionalInformation
Someencoders require a pull-up resistor to work properly with a DAQ device. Reviewthe specification sheet for the cDAQ and the
encoderto confirm if the resistor is needed and the value of it
需要说明的是,上述的例程和文档,都是可以下载的,双击即可打开,其中压缩文件是可以采用粘贴复制的方式,拷贝到硬盘上。这不是图片,各位小伙伴看到后尝试一下,这个问题就不用加微信咨询了。有关LabVIEW编程、LabVIEW开发等相关项目,可联系们。附件中的资料这里无法上传,可去公司网站搜索下载。
LabVIEW程序,如下附件所示。
楼主最近还看过