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.

Urgent!!!! Pic16f877 Adc

Status
Not open for further replies.

preeste

New Member
hi there

i have build a line follower robot using the above mentioned pic...i am now in the process of trying to program it.....i have used 3 phototransistors as sensors that are connected to AN0, AN1 and AN3 of the pic.....how do i actually go about programming it so that i should keep reading the outpts of these sensors all the time? please help me....i need the code in C.

thanks a lot....
 
You need to:-

Set the analog input to AN0
wait the sampling time
Start the conversion
wait for the conversion to finish
read the value of AN0

etc for AN1 and for AN2

repeat

There is only one ADC converter, but it is very quick so the whole lot takes very little time.

I only have code in assembly language.
 
lol...it is actually not a project...just a little thing i decided to do but in like 2 days i go back to school and wont hae anytime for my line follower....so thought i would finish as soon as possible....i am using the pic16f877 and it just makes sense to use the adc....thanks diver300...that was helpfuk
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top