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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…