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.

A/D conversion with an MCU

Status
Not open for further replies.

dak246

Member
I'm looking for a basic tutorial/example of A/D conversion with a PICmicro. I'm trying to interface a temperature sensor which outputs a voltage between -1 and +6V corresponding to -50 to 300 degs F. Then I want to display the temperature on a nokia 6100 lcd screen. I already wrote the code for the mcu/lcd interface, and if given a binary translation of the temp sensors output, I could display the actual temperature, but right now I'm somewhat clueless on how to do the conversion. So any links/suggestions etc. would be appreciated. Thanks.
 
Check my tutorials for PIC analogue to digital conversion - you will have to use an opamp to scale your sensor voltage - it can't go below zero or above Vref (normally 5V, or 2.5V if you use the better external reference as my tuorials do).
 
Nigel Goodwin said:
Check my tutorials for PIC analogue to digital conversion - you will have to use an opamp to scale your sensor voltage - it can't go below zero or above Vref (normally 5V, or 2.5V if you use the better external reference as my tuorials do).

Excellent. Thanks for the tutorial. Also, I know it may not be good practice, but since -1v corresponds to -50degs and +6v to 350degs, and my application is going to work between about 40degs and 90degs, couldnt I just disregard those extremes?
 
dak246 said:
Excellent. Thanks for the tutorial. Also, I know it may not be good practice, but since -1v corresponds to -50degs and +6v to 350degs, and my application is going to work between about 40degs and 90degs, couldnt I just disregard those extremes?

As long as the input voltage stays between zero and Vref you can ignore the extra range.
 
hi nigel, are you ever try avr microcontroller, what i should choose the microcontroller avr or pic, can you tell me what is the best from the both microcontroller
 
You would want to insert a 1k-2.5k resistance between that signal source and the pin, because not only will a voltage outside to 5-0v not convert properly, it'll damage the PIC. With some series resistance in there, the internal shunt diodes will keep the voltage on the pin from getting beyond the limits.
 
Oznog said:
You would want to insert a 1k-2.5k resistance between that signal source and the pin, because not only will a voltage outside to 5-0v not convert properly, it'll damage the PIC. With some series resistance in there, the internal shunt diodes will keep the voltage on the pin from getting beyond the limits.

I assume then I'll need to calculate the voltage after the drops to determine an accurate value of the positive reference?
 
januar1983 said:
hi nigel, are you ever try avr microcontroller, what i should choose the microcontroller avr or pic, can you tell me what is the best from the both microcontroller

It's really down to personal choice, the PIC has been about far longer than the AVR, and has far more support out on the Internet - but both can do the job.

When the AVR first appeared (even copying a three letter name like the PIC!) I made the decision to stay with the PIC (as most people did). If you come from a Z80 or 8080 programming background an AVR may be better for you?, but otherwise the PIC may be better?.
 
dak246:
Use a simple potential divider circuit to level-shift the sensor voltage to the PIC's input range. If you don't really care much for the temperatures outside those which produce 0-5V, use a 5.1V zener diode across the PIC's input, and put a resistor in series with the sensor.

In my opinion, the AVR's support for C is much better than for the smaller PICs, both in terms of availability of tools and in terms of internal architecture -- the AVR is designed from the ground up to be programmed in C. Also, gcc has been ported to the AVR, so there exist open-source development tools for the same. AFAIK, no such tools exist for the PIC.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top