Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Robotics Chat


Robotics Chat Specific to discussions about robots and the making of.

Reply
 
Thread Tools Display Modes
Old 20th February 2008, 12:57 PM   (permalink)
Experienced Member
 
Wingmax is just really niceWingmax is just really niceWingmax is just really nice
Default Setting up ADC in PIC16F684 (2)

Please refer cct diagram:



This is an example program to test the ADC function.

Continue from last discussion:

We have to calculate the Acquistion Time.
TACQ= Tamp + Tc + Tcoff
Tamp and Tcoff can be found from the data manual.
Tc can also be found from the manual, but varies by the analogue input source resistance.
We use 10K POT, so max Rs= 10k.
TACQ= 19.72 uS (20 uS approx) (Refer manual).

The conversion time is 11 TAD cycles. Last time we calculated the TAD= 2 uS. So
Conversion time= 11x 2= 22 uS.

We have to allow minimum of 20 + 22= 42 uS for each ADC sample.

In our example we use VDD as voltage reference. The conversion result is in 10 bits, so there are
1024 values (0 to 1023). Each value is equiv to VDD/ 1024= 0.0048828125v.

If we are using 10 LEDs, each one should come on at the increase voltage of 5/10= 0.5v .
The first one should come on at 0.5v (LSB), the third one at 1.5v, and the last one should come on
at 5v(MSB).

Since we only use 8 LEDs and left justified. So the first LED that comes on is the second bit of the conversion result but the 0 bit of ADRESH.

Here is the program code:

ADC test prog.txt


http://s271.photobucket.com/albums/j...t=IMGP1430.flv

URL=http://s271.photobucket.com/albums/jj148/wingmax2/?action=view&current=IMGP1430.flv][/url]
__________________
May the force be with you.


My project: Simple White Line Follower

http://au.youtube.com/watch?v=8Z_MmrdH4oc

http://i271.photobucket.com/albums/j...nefollower.jpg

Last edited by Wingmax; 24th February 2008 at 11:33 AM. Reason: upload picture and reload program codes
Wingmax is offline   Reply With Quote
Old 21st February 2008, 01:53 AM   (permalink)
New Member
Bobcan is an unknown quantity at this point
Default

Thanks wingmax, can u do a similur program on 16F877?
Bobcan is offline   Reply With Quote
Old 21st February 2008, 05:15 AM   (permalink)
Experienced Member
 
Wingmax is just really niceWingmax is just really niceWingmax is just really nice
Default

Quote:
Originally Posted by Bobcan
Thanks wingmax, can u do a similur program on 16F877?
You should be able to find it in Nigel's tutorial.
__________________
May the force be with you.


My project: Simple White Line Follower

http://au.youtube.com/watch?v=8Z_MmrdH4oc

http://i271.photobucket.com/albums/j...nefollower.jpg
Wingmax is offline   Reply With Quote
Old 18th March 2008, 04:25 PM   (permalink)
New Member
tomskj is on a distinguished road
Default

Hi

Do you have the source files for 'delay.c' and 'delay.h' ?

Cheers

Tom
tomskj is offline   Reply With Quote
Old 19th March 2008, 03:23 AM   (permalink)
Experienced Member
 
Wingmax is just really niceWingmax is just really niceWingmax is just really nice
Default

Go to this site and downloaded free.

http://www.microchipc.com/sourcecode/#delay16x
__________________
May the force be with you.


My project: Simple White Line Follower

http://au.youtube.com/watch?v=8Z_MmrdH4oc

http://i271.photobucket.com/albums/j...nefollower.jpg
Wingmax is offline   Reply With Quote
Old 20th March 2008, 03:13 PM   (permalink)
New Member
tomskj is on a distinguished road
Default

Thanks for this. I tried it and added the files 'delay.c','delay.h' and 'always.c' to the 'adctest.mcp'. Is this the correct way of doing it? When I tried to build the 'adctest.mcp' it gave some errors.

Cheers

Tom
tomskj is offline   Reply With Quote
Old 21st March 2008, 10:30 AM   (permalink)
Experienced Member
 
Wingmax is just really niceWingmax is just really niceWingmax is just really nice
Default

Quote:
Originally Posted by tomskj
Thanks for this. I tried it and added the files 'delay.c','delay.h' and 'always.c' to the 'adctest.mcp'. Is this the correct way of doing it? When I tried to build the 'adctest.mcp' it gave some errors.

Cheers

Tom
Hi Tom,
After downloading the delay routines, copy the delay.c and delay.h files into the same directory where you store your main source program, then in you main program put in #include "delay.c
#include "delay.h

just like what I did in my example program. No need to use 'always.c'
__________________
May the force be with you.


My project: Simple White Line Follower

http://au.youtube.com/watch?v=8Z_MmrdH4oc

http://i271.photobucket.com/albums/j...nefollower.jpg
Wingmax is offline   Reply With Quote
Old 21st March 2008, 11:39 AM   (permalink)
New Member
tomskj is on a distinguished road
Default

Thanks for this I'll try it out.

Tom
tomskj is offline   Reply With Quote
Old 27th March 2008, 04:37 PM   (permalink)
New Member
tomskj is on a distinguished road
Default

Wingmax

Thanks it worked a treat.

Cheers

Tom
tomskj is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Setting up ADC in PIC16F684 Wingmax Robotics Chat 0 16th February 2008 02:23 AM
PIC12F675 ADC Circuit help. MERV Micro Controllers 4 16th January 2008 08:05 PM
ADC troubles andy257 General Electronics Chat 4 2nd December 2007 05:49 PM
Using Oscilloscopes mechie Electronic Theory 9 29th November 2007 09:48 PM
16F877 Timer0 Interrupt Affecting ADC sebana Micro Controllers 13 12th September 2007 09:42 AM



All times are GMT. The time now is 02:08 PM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.