PIC16F785-I/P Microchip Technology Inc., PIC16F785-I/P Datasheet - Page 101

no-image

PIC16F785-I/P

Manufacturer Part Number
PIC16F785-I/P
Description
MCU, 8-Bit, 2KW Flash, 128 RAM, 18 I/O, DIP-20
Manufacturer
Microchip Technology Inc.
Datasheet

Specifications of PIC16F785-I/P

A/d Inputs
12-Channel, 10-Bit
Comparators
2
Cpu Speed
5 MIPS
Eeprom Memory
256 Bytes
Input Output
17
Memory Type
Flash
Number Of Bits
8
Package Type
20-pin PDIP
Programmable Memory
3.5K Bytes
Ram Size
128 Bytes
Speed
20 MHz
Timers
2-8-bit, 1-16-bit
Voltage, Range
2-5.5 V
Lead Free Status / Rohs Status
RoHS Compliant part Electrostatic Device
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 PIC16F785-I/P