SW006010 Microchip Technology, SW006010 Datasheet - Page 46

no-image

SW006010

Manufacturer Part Number
SW006010
Description
MPLAB 17C SOFTWARE
Manufacturer
Microchip Technology
Datasheets

Specifications of SW006010

Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC17C
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
MPLAB®
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
MPLAB
apRNOVS^-page 42
C17 C Compiler Libraries
OpenPWM1
OpenPWM2
OpenPWM3 (Continued)
Remarks:
Return Value:
File Name:
Code Example:
SetDCPWM1
SetDCPWM2
SetDCPWM3
Device:
Function:
Include:
Prototype:
Arguments:
period
The value of period can be any value from 0x00 to 0xff. This value
determines the PWM frequency by using the following formula:
Period1
Period2
Period3
This function configures the specified PWM channel for period
and for time base. PWM1 uses only Timer1. PWM2 and PWM3
can use either Timer1 or Timer2. Timer1 and Timer2 must be set
up as individual 8-bit timers for PWM mode to work correctly.
In addition to opening the PWM, Timer1 or Timer2 must also be
opened with an OpenTimer1(...) or OpenTimer2(...) statement
before any of the PWMs will operate.
None
pw1open.c
pw2open.c
pw3open.c
OpenPWM2(T1_SOURCE,0xff);
SetDCPWM1 - PIC17C4X, PIC17C756
SetDCPWM2 - PIC17C4X, PIC17C756
SetDCPWM3 - PIC17C756
Writes a new dutycycle value to the specified PWM channel duty
cycle registers.
pwm16.h
void SetDCPWM1 (static unsigned int dutycycle);
void SetDCPWM2 (static unsigned int dutycycle);
void SetDCPWM3 (static unsigned int dutycycle);
dutycycle
The value of dutycycle can be any 10-bit number. Only the lower
10-bits of dutycycle are written into the dutycycle registers. The
dutycycle, or more specifically the high time of the PWM
waveform, can be calculated from the following formula:
PWM x Dutycycle = (DCx<9:0>) x T
where DCx<9:0> is the 10-bit value from the
registers.
= [
= [
= [
= [
= [
(PR1)
(PR1)
(PR2)
(PR1)
(PR2)
+1] x 4 x T
+1] x 4 x T
+1] x 4 x T
+1] x 4 x T
+1] x 4 x T
OSC
OSC
OSC
OSC
OSC
OSC
 2002 Microchip Technology Inc.
PWxDCH:PWxDCL

Related parts for SW006010