Digital I/O

Showing results for 
Search instead for 
Did you mean: 

USB-6002 using Python to generate a pulse signal?

Go to solution

I am trying to use Python (with the nidaqmx module) to generate a PWM signal from a USB-6002 DAQ. I can read from and write to the analog and digital ports. However, I am not able to generate a pulsing signal. 


I am using the example code from the nidaqmx repository:


Is there a way to do this with my 6002, or do I need to get a different DAQ? 


Thank you!

0 Kudos
Message 1 of 3
Accepted by topic author soniaroberts

Unfortunately, the 6002 does not support counter output tasks.  The best you could hope for is to toggle a DO line under software-timing control, but that's unlikely to work out in most apps that call for PWM in the first place.  The output frequency will be limited (probably somewhere in the order of 1 kHz), and quite erratic (regularly dropping into the low 100's or less). 


You might still get away with it if you're controlling something like heater rope and a decent-size thermal mass, as well as being clever about observing and compensating for timing irregularities.  But for most PWM usages, you'll need a DAQ that supports counter output.



-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW?

(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).

0 Kudos
Message 2 of 3

Thanks Kevin! That's very helpful. I had already tried generating my own PWM signal with the DO ports and the frequency I could get was, indeed, nowhere near fast enough for my application.

0 Kudos
Message 3 of 3