PIC16HV785 Microchip Technology Inc., PIC16HV785 Datasheet - Page 101

no-image

PIC16HV785

Manufacturer Part Number
PIC16HV785
Description
20-pin Flash-based 8-bit Cmos Microcontroller
Manufacturer
Microchip Technology Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC16HV785-E/ML
Manufacturer:
LEGERITY
Quantity:
100
Part Number:
PIC16HV785-E/P
Manufacturer:
MICROCHIP
Quantity:
12 000
Part Number:
PIC16HV785-E/SO
Manufacturer:
MICROCHIP
Quantity:
12 000
Part Number:
PIC16HV785-E/SS
Manufacturer:
MICROCHIP
Quantity:
12 000
Part Number:
PIC16HV785-I/ML
Manufacturer:
MICROCHIP
Quantity:
12 000
13.8
When configuring the Two-Phase PWM, care must be
taken to avoid active output levels from the PH1 and
PH2 pins before the PWM is fully configured. The
following sequence is suggested before the TRISC
register or any of the Two-Phase PWM control registers
are first configured:
• Output inactive (OFF) levels to the PORTC RC1/
• Clear TRISC bits 1 and 4 to configure the PH1
• Configure the PWMCLK, PWMPH1, PWMPH2,
• Configure the PWMCON0 register.
EXAMPLE 13-1:
© 2006 Microchip Technology Inc.
;Example to configure PH1 as a free running PWM output using the SYNC output as the duty cycle
;termination feedback.
;This requires an external connection between the SYNC output and the comparator input.
;SYNC out = RB7 on pin 10
;C1 inverting input = RC2/AN6 on pin 14
;Configure PH1, PH2 and SYNC pins as outputs
;First, ensure output latches are low
;Configure the I/Os as outputs
;PH1 shares its function with AN5
;Configure AN5 as digital I/O
;Configure the PWM but don't enable PH1 or PH2 yet
;PWM control setup
;PWM clock setup
;PH1 setup
;PH2 setup
;Configure Comparator 1
;Configure comparator voltage reference
;Everything is setup at this point so now it is time to enable PH1
;Module is running autonomously at this point
AN5/C12IN1-/PH1 and RC4/C2OUT/PH2 pins.
and PH2 pins as outputs.
and PWMCON1 registers.
BCF
BCF
BCF
BANKSEL TRISB
BCF
BCF
BCF
BCF
BANKSEL PWMCLK
MOVLW
MOVWF
MOVLW
MOVWF
MOVLW
MOVWF
MOVLW
MOVWF
MOVLW
MOVWF
BANKSEL VRCON
MOVLW
MOVWF
BANKSEL PWMCON0
BSF
PWM Configuration
PORTC,1
PORTC,4
PORTB,7
TRISC,1
TRISC,4
TRISB,7
ANSEL0,5
B'00001100'
PWMCON0
B'00111101'
PWMCLK
B'00101111'
PWMPH1
B'00110101'
PWMPH2
B'10011110'
CM1CON0
B'10101100'
VRCON
PWMCON0,PH1EN
PWM SETUP EXAMPLE
;PH1 low
;PH2 low
;SYNC low
;PH1 output
;PH2 output
;SYNC output
;AN5 is digital, all others default as analog
;auto shutdown off, no blanking, SYNC on, PH1 and PH2 off
;see data sheet page 93
;pwm_clk = Fosc, 30 clocks in PWM period
;see data sheet page 94
;non-inverted, terminate on C1, Start on clock 15
;see data sheet page 95
;non-inverted, terminate on C1, Start on clock 21
;see data sheet page 96
;C1 on, internal, inverted, normal speed, +:C1V
;see data sheet page 68
;C1V
;see data sheet page 71
;enable PH1
REN
on, low range, CV
Preliminary
REF
= V
DD
PIC16F785/HV785
/2
REF
, -:AN6
DS41249D-page 99

Related parts for PIC16HV785