LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Counters as Input & Output simultaneously

Hello All,
 
I am using PCI 6221 (68 pin), I am using one of the counters as inputting pulses to a servo, can I use the other counter "Counter 2" for counting thoses pulses which I am generating from "Counter 1", also I want to make it synchronized.
 
As soon as I generate pulses my reading counter should start, anyone help me with some example.
 
Using LV 8.0
 
Thanks
0 Kudos
Message 1 of 3
(2,231 Views)

Hello James,

If you are outputting a continuous pulse train then you should be able to use the second counter to read them back in.  If you're doing a finite generation to the servo motor then that task is actually using both counters (one counter gates the other:  How Many Counters Does Each Type of Counter Input or Output Task Take?).  Assuming that you do have an available counter then you can run any of the single counter input tasks listed in the above KnowledgeBase article.  There are a number of counter input task examples in the LabVIEW Example Finder that you can access by opening LabVIEW and going to Help» Find Examples...  Then navigate to Hardware Input and Output» DAQmx» Counter Measurements.  From there you'll need to find the example for whatever type of measurement you want to do.

Synchronization is a different issue.  In general synchronization requires that two tasks start at the same time and share a timebase.  In this case, you can start the counter input task first since it will be waiting on the counter output to start measurements.  Then, if you do a buffered counter input measurement (see example finder--you'll need to set up an implicit sample clock), you'll get exactly one counter input measurement for each period of the counter output.  This happens because for frequency/period/pulse width the counter latches one value on each rising or falling edge so the measurements are automatically synced.

I hope this helps, and have a great day!

Brooks
0 Kudos
Message 2 of 3
(2,193 Views)
Thanks Brooks,
 
Your information was really helpful.
 
Thanks & Regards
James
0 Kudos
Message 3 of 3
(2,181 Views)