![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hi guys can u plz post the ckt of microcontroller used as an ADC ? If possible the code as well .. plz help its urgent ... | |
| |
| | (permalink) |
| Check my tutorials!. | |
| |
| | (permalink) |
| okay, relax! on which micro controller are you working..? i suppose it is a 8051 cause it doesn't have an ADC .. right? | |
| |
| | (permalink) |
| If you’re going down the PIC Micro road, maybe this could help Click here to watch this circuit in action This circuit is designed to take 2 ADC samples and display them on an LCD, heres the program; Code: Device 16F877
Declare XTAL 4
DECLARE ADIN_RES 10 ' 10-bit result required
DECLARE ADIN_TAD FRC ' RC OSC chosen
DECLARE ADIN_STIME 50 ' Allow 50us sample time
Declare LCD_TYPE 0 ' Type of LCD Used is Alpha
Declare LCD_DTPIN PORTB.4 ' The control bits B4,B5,B6,B7
Declare LCD_RSPIN PORTB.2 ' RS pin on B2
Declare LCD_ENPIN PORTB.3 ' E pin on B3
Declare LCD_INTERFACE 4 ' Interface method is 4 bit
PORTB_PULLUPS True
Dim Result1 As Float
Dim Result2 As Float
Dim Last_Result1 As Float
Dim Last_Result2 As Float
Symbol Input1 = PORTA.0
Symbol Input2 = PORTA.1
TRISA = %00000011 ' Configure AN0 (PORTA.0+1) as an input
ADCON1 = %10000000 ' Set analogue input, Vref is Vdd
Main:
Result1 = ADIN 0 ' Grab A0's digital value
Delayus 1 ' Allow internal capacitors to charge
Result2 = ADIN 1 ' Grab A1's digital value
Result1 = Result1 * 5 / 1023 ' Scale it to volts
Result2 = Result2 * 5 / 1023 '
If Last_Result1 <> Result1 Then ' Check if value has changed
Print At 1, 1, Dec2 Result1, "V " ' If it has, display new data
Last_Result1 = Result1 ' and update last value
EndIf
If Last_Result2 <> Result2 Then ' Check if value has changed
Print At 2, 1, Dec2 Result2, "V " ' If it has, display new data
Last_Result2 = Result2 ' and update last value
EndIf
Goto Main ' Loop for ever ![]() If your using voltages over 5V, the logic device must be protected from them with a simple voltage divider similar to this; Now the voltage will be reduced by 50% and you can easily sample this and multiply the sample result by two too scale it back up. 10 Bit ADC has a resolution of 0.0048 Volts, its more than enough for many applications.
__________________ Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net | |
| |
| | (permalink) |
| im working on 89c051 | |
| |
| | (permalink) | |
| Quote:
The idea is to let the micro generate numbers from 0 to 255, feed them to the R/2R DAC, generating voltages from 0 to 5v, and at each step compare the o/p with your voltage to be measured using the second op-amp (configured as a comparator). you will get a '1' out of the second op-amo when your counter reach the measured voltage. here, stop counting, and the last counted number (btw 0 and 255) is the digital value propotional to the analog input. | ||
| |
| | (permalink) | |
| Quote:
Buy a ready made ADC chip | ||
| |
| | (permalink) |
| chek it. if u find it useful i will send u code Last edited by abbas1707; 12th March 2007 at 01:25 PM. | |
| |
| | (permalink) |
| i think the author of the thread wanted to use "a 8051 µC as an ADC" right? | |
| |
| | (permalink) |
| hi gramo, Is the 2*100k resistive divider input to the 16F877 ADC a mis-type. Considering the specified maximum adc input impedance of 10K. Eric | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Sorry about that, it was a quick click in paste, wasn’t actually think that far into it This is more like it So what’s the most efficient/accurate impedance for ADC samples with PIC’s?
__________________ Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net | |
| |
| | (permalink) | |
| Quote:
For an experiment, set up two analogue inputs, and read and display them both in a continuous loop - easy in your BASIC compiler. Take one pin to 5V and one to 0V, the first should read 255 and the second zero. Now connect the pins via 100K resistors, and see what readings you get - they won't be correct any more, add a time delay after each reading, adjust the delay until both read correctly again. Try it with 1Meg and 10K resistors, and meausre the difference! - post your results here, it could be informative. | ||
| |
| | (permalink) |
| I'd be curious as well.
__________________ "Because I be what I be. I would tell you what you want to know if I could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." | |
| |
| | (permalink) |
| Guys, let's say I want to sample voltages in a range of 40V using pic. I need to reduce the voltage to 5 volts max. You were using voltage dividers, but is there another way of doing that without making a path between Vdd and Vss? Also, according to pic datasheet, the resistance of the source should be less then 2.5k in order to sample it properly, in the case of gramo's post, is the resistance 1k||1k = 0.5k (grounding Vdd like large signal analysis for xtors)? Thank You. | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| Microcontroller interface with ADC | revjam | Chit-Chat | 4 | 1st August 2008 09:21 AM |
| how to interface a ADC 0809 TO MICROCONTROLLER AND THEN MICROCONTROLLER TO DECODER | praneeth22 | Micro Controllers | 1 | 9th March 2007 07:20 PM |
| clock source for microcontroller stk500 | hani_a | Micro Controllers | 0 | 22nd June 2004 12:37 AM |
| Connection of Siemens c167 microcontroller to peripherals. | Roslan | Electronic Projects Design/Ideas/Reviews | 3 | 23rd March 2004 07:52 PM |
| Interfacing a microcontroller with a modem | matt_d82 | General Electronics Chat | 3 | 21st March 2004 03:43 AM |