![]() | ![]() | ![]() |
| | |||||||
| Robotics Chat Specific to discussions about robots and the making of. |
| | Thread Tools | Display Modes |
| | (permalink) |
| Experienced Member | 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¤t=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 |
| | |
| | (permalink) |
| New Member | Thanks wingmax, can u do a similur program on 16F877? |
| | |
| | (permalink) | |
| Experienced Member | Quote:
__________________ 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 | |
| | |
| | (permalink) |
| New Member | Hi Do you have the source files for 'delay.c' and 'delay.h' ? Cheers Tom |
| | |
| | (permalink) |
| Experienced Member |
__________________ 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 |
| | |
| | (permalink) |
| New Member | 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 |
| | |
| | (permalink) | |
| Experienced Member | Quote:
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 | |
| | |
| | (permalink) |
| New Member | Thanks for this I'll try it out. Tom |
| | |
| | (permalink) |
| New Member | Wingmax Thanks it worked a treat. Cheers Tom |
| | |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| 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 |