Created
March 22, 2018 19:56
-
-
Save nvladimus/69b34418eb0f9ca0d0a0f0dc335b1a3e to your computer and use it in GitHub Desktop.
Digital pulse generation with PyDAQmx in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple digital pulse generation with PyDAQmx library and NI DAQmx board | |
# Requires NI DAQmx drivers, Python 2.7 installed, Windows. | |
# Tested on NI PCIe-6321 board | |
# Gist author: Nikita Vladimirov @nvladimus | |
import PyDAQmx as pd | |
ctr_ini_delay = 0 # sec | |
ctr_period = 0.1 # sec | |
ctr_duty_cycle = 0.01 | |
task = pd.Task() | |
task.CreateCOPulseChanFreq("Dev1/ctr0", "CamTrigger", pd.DAQmx_Val_Hz, pd.DAQmx_Val_Low, ctr_ini_delay, 1/float(ctr_period), ctr_duty_cycle) | |
task.CfgImplicitTiming(pd.DAQmx_Val_ContSamps, 1000) | |
task.StartTask() | |
# Go and measure the pulses with oscilloscope. | |
# Output will be at terminal pin "Ctr0 OUT" | |
# check your NI DAQmx board pinout diagram for terminal location | |
# It was "PFI 12" on my board NI PCIe-6321. | |
task.StopTask() | |
task.ClearTask() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment