Difference between revisions of "NU32v2: Output Compare, PWM, and Analog Output"

From Mech
Jump to navigationJump to search
Line 1: Line 1:
'''*** UNDER CONSTRUCTION ***'''

A couple of introductory sentences here.

== Overview ==


== Details ==


== Library Functions ==


== Sample Code ==

Code for PWM:
Code for PWM:
<pre>
<pre>
Line 5: Line 20:
SetDCOC1PWM(duty); // unsigned int duty from 0-1000
SetDCOC1PWM(duty); // unsigned int duty from 0-1000
</pre>
</pre>

== More Information ==

Revision as of 00:57, 30 January 2011

*** UNDER CONSTRUCTION ***

A couple of introductory sentences here.

Overview

Details

Library Functions

Sample Code

Code for PWM:

OpenTimer2(T2_ON | T2_PS_1_4, 1000); // for 20kHz PWM: 80000000Hz / 4ps / 20000Hz = 1000
OpenOC1(OC_ON | OC_TIMER2_SRC | OC_PWM_FAULT_PIN_DISABLE, 0, 0); // PWM output on Pin D1
SetDCOC1PWM(duty); // unsigned int duty from 0-1000

More Information