![]() |
|
|
Introduction
This example program demonstrates how to programmatically reset a counter using NI-DAQmx, after a specified amount of time (in milliseconds). When the specified amount of time has elapsed, we write the current count along with the timestamp (from the system clock) to a file using the ASCII File I/O VIs.
Steps to Complete
Hardware
1. Wire the digital signal (to count edges) to a counter on the device
Running the VI
1. Specify the time interval in which the counter will be reset
2. Configure the count edges channel (device, counter, count direction, etc.)
3. Run the VI (press run arrow)
4. Specify the name and location for the ASCII file to write the count/timestamp to
5. Stop button will end the acquisition and clear resources
Block Diagram
1. Create count edges channel
2. Create ASCII file to write count/timestamp to
3. Start counter task
4. Read from counter
5. If elapsed time is greater than/equal to specified time interval, enter True case of case structure.
6, Write the count & timestamp to file
7. Reset counter by stopping and resetting the task
8. Reset elapsed time and repeat steps 4-7
9. Stop button will stop the acquisition
10. Close file ,clear task and handle errors.
Thanks for posting... Could you please include some screenshots of your code?