VREF PIC16F

ericgibbs

Joined Jan 29, 2010
21,391
HI eric gibbs, maxhead rooms i want to use vref 5v like reference to create a variable pwm with external potentiometer
Hi math,
For that application you would set the RA2 pin as a VREF output, driving a high input impedance OPA.

The Vout of the OPA would drive a potentiometer, whose wiper could be used to control the ratio of a PWM generator.

Write the PIC Code for RA2/VCON to suit the range of voltage you require as an RA2 output voltage, Bits 5, 3,2,1,0

E
EG57_ 2278.png
 

Attachments

Last edited:

LesJones

Joined Jan 8, 2017
4,511
From what you say in post #8 you seem to think the vref on the PIC16F628 is generated frim an internal precision voltage reference module s it is in some other PICs. It is just derived from the 5 volt power supply via a ladder network as shown on page 59 of the data sheet. (It is a bit like a DAC without the output buffering.) The PIC16F628 does not have an ADC so you can't use it to feed the voltage from the slider on the potentiometer into the PIC to control the PWM duty cycle. To do what you seem to want to do you will need a different PIC. I have done something similar to what I think you may be trying to do using a PIC16F876. This was for a closed loop motor speed controller driving the X axis of a milling machine. You would get better help if you provided more details of your project.

Les.
 
Top