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.
How should I connect it, and what is the code for reading a potentiometer using a Pic 16f88? I am programming with Asm I have most everything else I need planned out besides this. Also can you explain your method as well? Please and Thank you.
You would normally use the supply voltage and ground as the positive and negative voltage references, and they would also be the ends of the potentiometer. The wiper of the potentiometer is should be connected to the analog input of the 16F88. A capacitor from the wiper to ground is a good idea.
The code needs to enable the correct input, wait for a few microseconds (the acquisition time) and then start the conversion. After the conversion time, the "Done" bit is set and the A/D result can be read from ADRESH and ADRESL
Yes, that's what you do. There is only one A/D converter but it only takes microseconds to make a reading, so you can read as many as you want so fast that it will appear instantaneous compared to how fast a mechanical pot can move.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.