05-11-2009 11:19 AM
05-12-2009 06:30 AM
Hi Atacama,
Good afternoon and I hope your well today.
Thanks for your post!
Are you using LabVIEW to program your counter card?
If so, there is an example in the NI Example Finder (Help>>Find Examples..) titled Count Digital Events - Buffered-Continuous-Ext Clk.vi. This can be used with the 6602 (among many others).
The 6602 has 8 general purpose counters which you can use. It is upto you which counter you use.
In the DAQmx Help File (All Programs>>NI>DAQ>>NI-DAQmx Help) search for 'TIO Signal Connections for Counters'. It has a table showing you the connections you need to make to perform many types of measurements, including counting edges.
It states (for example), for counter 0 for example & to count edges you need to use,
Edges: PFI 39
Count Direction: PFI 37
You can also find out pin-out/pin-layout inform in Measurement and Automation Explorer (MAX) but locating the device in MAX, and Right-clicking and selecting Device Pinouts. You can also search for this in the DAQmx Help file, Device Terminals - NI 6602.
It tells you that (for the example) PFI 39 is pin2 - Counter 0 Source
and that PFI 37 is pin 40 - Counter 0 Aux.
I hope this helps,
05-12-2009 06:47 AM
Hi James,
Thank you for your reply.
So, if I read this correctly, I have to use Counter 2 to run by buffered event counting on PFI 19.
Now, my gate is PFI 19.
I do not get any data back. Basically, the loop never stops.
For information, I attach my VB6 code:
lCounter = ND_COUNTER_2
iStatus = GPCTR_Control(i6602DeviceNum, lCounter, ND_RESET)
iStatus = GPCTR_Set_Application(i6602DeviceNum, lCounter, ND_BUFFERED_EVENT_CNT)
'set the source
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, lCounter, ND_SOURCE, ND_PFI_31) ' SOURCE_2
'set the gate
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, ND_COUNTER_0, ND_GATE, ND_PFI_19)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, lCounter, ND_INITIAL_COUNT, 0)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, lCounter, ND_BUFFER_MODE, ND_SINGLE)
iStatus = GPCTR_Change_Parameter(i6602DeviceNum, lCounter, ND_COUNTING_SYNCHRONOUS, ND_YES)
iStatus = GPCTR_Config_Buffer(i6602DeviceNum, lCounter, 0, 64, aBuffer(0))
iStatus = GPCTR_Control(i6602DeviceNum, lCounter, ND_PROGRAM)
Do
iStatus = GPCTR_Watch(i6602DeviceNum, lCounter, ND_ARMED, ulArmed)
Loop While ((ulArmed = ND_YES) And (iStatus = 0))
iStatus = GPCTR_Read_Buffer(i6602DeviceNum, lCounter, ND_BUFFER_START, 0, 64, 5, lPointsRead, aBuffer(0))
I have tried using the CWdaq component to run something similar. I get an error when trying to configure my counter. The error refers to an improper gate definition.
Do you have any idea of what can be wrong?
Thanks
05-12-2009 08:31 AM
Hi Atacama,
Thanks for the prompt reply and I hope your well this afternoon.
If you wish to count edges on PFI 19 you will need to use Counter 5, as PFI 19 is the Source of Counter 5.
If you look at the image of the table I attached, if you read along the first row titled Count Edges, PFI 19 is under Counter 5.
If you still have problems, I will look at your VB6 code - there should be an example of DAQmx Counters.. have you used one?
NI-DAQmx Examples for Visual Basic 6.0
http://digital.ni.com/public.nsf/allkb/735848148B5B4964862571F5004692C7?OpenDocument
This may also help,
NI-DAQmx: Counter Measurements - Count Digital Events - Buffered Finite with External Clock in .NET
http://zone.ni.com/devzone/cda/epd/p/id/5831
05-12-2009 08:46 AM
Hi James,
Sorry for the confusion. My gate is PFI 19. But my source is PFI 31.
So, is it correct to use COUNTER 2 for this?
By the way, I also tried Counter 5. I still get no data back.
I am not using DAQmX. For legacy reasons, I have to stick to some programs which rely on old codes, so I use Traditional DAQ with VB6.
Thank you for your help.
Let me know if you can find a solution to my application.
Regards.
05-12-2009 09:00 AM
Hi Atacama,
Thanks for the reply.
Why do use want to use PFI 19 and PFI 31 - they aren't for the same counter...
PFI 19 is Counter5 Source
PFI 31 is Counter 2 Source
If you wish to counter edges, using Counter 2 then place the TTL signal onto PFI 31- Counter 2 Source. This is the only connection you need to make. Have you got Measurement and Automation Explorer (MAX) installed? If so, you can run a Traditional DAQ testpanel to test this functionality.
The Gate is an input signal that determines if an active edge on the source changes the count. Counting can occur when the gate is high, low, or between various combinations. Gate settings are made in software - so for now, I would recommend not doing this.
Hope this helps,
05-12-2009 09:10 AM
Thank you for your reply.
I can test my PFI signals using the test panel in MAX. I get counts from PFI 31 and from PFI 19.
But, I do not want to do simple event count.
I would like to do buffered event counting by gating PFI31 with PFI 19. Unfortunately, my signal connections are already done. I do not have much hardware flexibility.
How can I do this?
Regards.
05-12-2009 09:34 AM
Hi Atacama,
Thanks for the reply.
It is not possible to internally route these signals. The pin assigned of the sources are fixed.