Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Vref help required

Status
Not open for further replies.

JeanTech

Member
Hi There

I want to use the PIC16F627A's Vref module to output a certain voltage set in software to PIN RA2 (Vref output pin).

The voltage output current should be at least 10mA.

Does someone know of a simple circuit to use the Vref's output pin as a voltage output at 10mA?

Also, how would the coding look for this circuit?

Thanks in advance
JeanTech
 
Hi There

I want to use the PIC16F627A's Vref module to output a certain voltage set in software to PIN RA2 (Vref output pin).

The voltage output current should be at least 10mA.

Does someone know of a simple circuit to use the Vref's output pin as a voltage output at 10mA?

Also, how would the coding look for this circuit?

Thanks in advance
JeanTech

hi,
The Vref for the adc in the 16F627 is an INPUT pin, the Vref is generated externally and connected into the PIC's Vref pin.
EDIT:
I have overlooked VRCON:eek:
 
Last edited:
Thanks Eric, I'm new to electronics and still need to learn everything.

I saw in the datasheet that the PIC has a 16-tap resistor ladder for use with the Vref output, thus the PIC must be able to generate it's own Vref voltage for use with it's own comparators.

The problem is that when I connect my multimeter to pin RA2 (vref output pin), I measure less than 1 volt, when I programmed the Vref module to output 1.25V.

Do you maybe have a simple circuit and source code to show how to use the Vref module?

Alternatively I could also use PWM to generate a voltage between 0V-5V. How should I connect the PWM output to the load and would the source code be that of normal PWM?

Thanks in advance
JeanTech
 
hi Jean.
Looking a the VRCON register,for 1.25Vref you need to load it with.
11100110 binary, = 0xE6
Thats the high nibble 'Eh', switches ON and enables the Vref output and sets the range to low.
The 0110, 6h is decimal 6, so Vref = (6/24) * 5Vdd = +1.25V
 
You will not be able to source 10mA from the Vref output as the resistors in the ladder are 2k each. The maximum current you can draw would be in the order of a few uA. If you tell us what you need it for there may be an alternative solution.

Mike.
 
Thanks for all the help, I really appreciate it :)

I've come up with an alternative solution to my problem, so I'm not going to use the Vref anymore. I am now using a potentiometer connected to my microcontroller. I need three states (0V, 2.5V and 5V). What I did was to connect the two ends of the potentiometer to my microcontroller. When I require 0V, I sink both outputs. When I require 2.5V (or anything between 0 and 5V), I source one output and sink the other and finally when I require 5V, I just source both outputs.

Thanks again for all the support
JeanTech
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top