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.

Using ADC function of pic16f877

Status
Not open for further replies.

mesamune80

New Member
Hi all,

i am doing a project regarding a force sensor and a microcontroller.the basic idea of my project is i need to monitoring the force excerted to the sensor and using microcontroller to control/position my tools.so that my tool is always floating ,for this i need to convert the force to digital form and monitoring it thru microcontroller.my force sensor is powered with 12Vdc so that my range would be from 0v to 12vdc.but from what i know is the allowable analog input for microcontroller is just 5V.So any alternative method can i use?
Thanks.
 
Assuming that when your tool is floating the output voltage is zero, you could just use a resistor to limit the current into the pic and rely on the clamping diodes to ensure the pic only sees 5V. You would then get a reading that went from 0 to 1023 as the sensor went from 0 to 5V and a reading of 1023 for sensor voltages above 5V. If you wanted to be doubly safe you could use a 5.1V zener from the pic pin to ground.

Mike.
 
Hi nigel,just now i went to your website and i found the analogue input board you have in your tutorial session,i wonder what is the key point for me to determine the value of all the resistor ? can i just substitute them with a different value resistor?
 
i would like to do a full scale caliberation,for instance if my input is 12v then the analogue input to my uC is 5.0V .if my input from my sensor is less, then the analog input also will change corresponse to my sensor input voltage.how could i manage to achieve this?Can i just use two resistor ,act as attenuator,so to get the approximate value 5.0v to my uC pin? Thanks
 
Last edited:
what is ther tolerance voltage for analogue input pin for 16f877 ? if i use 2 resistor as attenuator then i doubt that i can get exactly 5v from 12v. if i would like to use 3 channels is it the same configuration i use?
 
mesamune80 said:
what is ther tolerance voltage for analogue input pin for 16f877 ? if i use 2 resistor as attenuator then i doubt that i can get exactly 5v from 12v. if i would like to use 3 channels is it the same configuration i use?

You don't have to get exactly 5V, slightly under would be fine. Inputs should be current limited so the protection diodes can protect the chip if you apply too much voltage.

If you check my tutorial hardware you will notice that I include a resistor between the opamp and the chip for this reason, and that the opamp is fed from 5V, so can't go above 5V anyway.
 
so inorder for me to get 5.0V for full scale i must use the programmable shunt regulator connect to +Vref?is it possible for me to use just two resistor for down sclae my readings?
 
mesamune80 said:
so inorder for me to get 5.0V for full scale i must use the programmable shunt regulator connect to +Vref?is it possible for me to use just two resistor for down sclae my readings?

As long as your input voltage is higher than Vref you can use a simple attenuator to reduce the input voltage, exactly as your meter and scope does. But pay attention to the impedances.
 
Thanks Nigel,just now I use EWB to simulate a part of your analogue input circuit ,i noticed that the output form the opamp is about 6.5V ,my input voltage to my opamp is 12V .if i don't use a zener or shunt regulator ,then the output voltage would be too high for my pin, i think?if i just follw exactly your circuit would it be enough for my project?
 
My circuit is limited to 5V because that's the supply voltage, using a 12V supply obviously means you can potentially get 12V applied to the PIC pin.

My circuit, as is, is designed to accept an input of 0-10.23V - you just need to alter the front attenuator to change that.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top