- PWM Output (16-Bit, Mode 0) [U3 Datasheet] | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver - PWM Output (16-Bit, Mode 0) [U3 Datasheet]

Outputs a pulse width modulated rectangular wave output. Value passed should be 0-65535, and determines what portion of the total time is spent low (out of 65536 total increments). That means the duty cycle can be varied from 100% (0 out of 65536 are low) to 0.0015% (65535 out of 65536 are low).

The overall frequency of the PWM output is the clock frequency specified by TimerClockBase/TimerClockDivisor divided by 216. The following table shows the range of available PWM frequencies based on timer clock settings.

Table 16-bit PWM Frequencies

   PWM16 Frequency Ranges 
TimerClockBase Divisor=1  Divisor=256
0 4 MHz 61.04 N/A
1 12 MHz 183.11 N/A
2 48 MHz (default) 732.42 N/A
3 1 MHz /Divisor 15.26 0.06
4 4 MHz /Divisor 61.04 0.238
5 12 MHz /Divisor 183.11 0.715
6 48 MHz /Divisor 732.42 2.861

Note that the clocks above apply to the U3 hardware revision 1.21. With hardware revision 1.20 all clocks are half of those values.

The same clock applies to all timers, so all 16-bit PWM channels will have the same frequency and will have their falling edges at the same time.

PWM output starts by setting the digital line to output-low for the specified amount of time. The output does not necessarily start instantly, but rather has to wait for the internal clock to roll. For 16-bit PWM output, the start delay varies from 0.0 to TimerClockDivisor*65536/TimerClockBase. For example, if TimerClockBase = 48 MHz and TimerClockDivisor = 1, PWM frequency is 732 Hz, PWM period is 1.4 ms, and the start delay will vary from 0 to 1.4 ms.

If a duty cycle of 0.0% (totally off) is required, consider using a simple inverter IC such as the CD74ACT540E from TI. Or you can switch the mode of the timer to some input mode, and add an external pull-down to hold the line low when set to input.


Am I able to use both the 16 and 8 bit PWM Outputs at the same time? I want to create two PID controllers for a temperature control system I am creating. I am using LabView 2010.

Thanks in advance..

Yes, one timer can be used in 8-bit mode while another is in 16-bit mode. Note that they will both be dependent on the TimerClock, so the timer set to 8-bit will output 256 times the frequency of the 16-bit timer.


I would like to produce a PWM signal with variable duty cycle. The frequence must be in the 200-100 kHz. Is it possible to use U3? If no did you have some product for this application?

Thank you in advance

Arouna DARGA

The U3 can produce PWM signals up to 187.5kHz. Though only in 8-bit PWM mode: http://labjack.com/support/u3/users-guide/

Which is the voltage of the PWM16 or PWM8 signal?? Because I need to make a PWM signal that has 5 voltage when is high and 0 when is low... so how can I control that, or all the signal that generate the U3 are with the same amplitud??

Timer outputs drive the line between digital output-high and output-low, so that means 3.3V and 0V.  See Section 2.8 and Appendix A.  If you want to translate to 5V/0V, there are various options but one easy option is to use a CD74ACT541E buffer (or CD74ACT540E inverter).  Let us know more about your load and perhaps we can evaluate the best way to interface to it.


How can I used the buffer you refering to?? I don't have much experience ussing the LabJackU3.

It is a very easy IC to use.  Connect OE1/OE2/GND all to GND on the U3.  Connect VCC to VS on the U3.  Connect A0 to FIO4 on the U3, and the level-shifted signal will appear on Y0.  For more detail, I would start a topic on our forum.

Also, can you provide any more information about your load and perhaps we can evaluate the best way to interface to it?  Perhaps 3.3V will work fine.

I had manage to make the motor work with the PWM16 ussing a timer clock 48MHZ/Divisor and a divisor of 14, but I'm going to see the signal in a scope to make sure that one works. I still like to increse the magnitud, so the CD74ACT541E is like an external amplifier?? But I don't know if I can get one, or even if they sell those in my country. Isn't a way to amplify the signal with the U3??

labjack support's picture

The CD74ACT541E is a logic buffer.  It recognizes the 3.3V input signal, and outputs a buffered signal at the supply voltage which is 5V if you power it from VS.  In my opinion the CD74ACT541E is the best and easiest way to shift a 3.3V signal to 5V.  There are many similar logic buffer ICs also.

Other ways to change from 3.3V to 5V are a comparitor (correct spelling is comparator), op-amp, or in some cases just a pull-up resistor.  Also see the comment in Section 2.5 from September 8th, 2010.

Can you provide any more information about your load and perhaps we can evaluate the best way to interface to it? Perhaps 3.3V will work fine?

Maybe I don't need to, because I was able to make the electric motor work. But still I'll try the  CD74ACT541E to see how that goes. The other quetions that I'll like to know is if I calculate the frecuency rigth. So I used this formula frecuency=ClockTimer/2^16/Divisor, So if I'm ussing a 48MHz/Divisor and the divisor is 14, that gives me 48MHz/2^16/14=0.0052... but waht is the unit, is it Hz or KHz? Sorry but I'm a little bit conffuse whit the frecuency, I try another one and the motor started shaking, so I'll like to know so I wont break it.

and what do you mean when you said you need more info in the load??

You can ignore my previous comment.  I found the explanation here



The comment mentioned is on this page:


i try to create a PWM signal (with  frequency and amplitude adjustable) with Labjack U12 and LabView interface, but u12 is not "tagged" so i assume that it's not possible ?

All other LabJacks are much better at making PWM signals, but the U12 does have limited support with it's PulseOut functions.  See Sections 4.25 to 4.28 of the U12 User's Guide, and see the pulse output LabVIEW examples.