Home |
Search |
Today's Posts |
#1
Posted to sci.electronics.design,alt.electronics,sci.electronics.components,sci.electronics.misc
|
|||
|
|||
Need advice on using the PIC 18F1320's AD converter
Hi all,
I am doing a project for someone that involves using the A/D converter on a PIC18F1320 microcontroller. I believe I have it all licked, apart from I just cannot figure out how to use the A/D converter properly. This is my first experience with microcontrollers, so please forgive my ignorance if this seems like a basic problem. I have a sensor on AN0, which outputs a voltage anywhere between 0.4v and 2.75v - which is what I want to read so the chip can determine what is going on in the outside world. Now i'm using AVdd/AVss as a voltage reference - which i've interpretted as meaning it uses the + and - power supply to the chip.. which incidently is a regulated 5v supply powered off a 9v battery. I've set the configuration to what I believe is correct, the chip will be operating at 1MHz and i've used an acquisition time of 8TAD, set the A/D converter up as specified in the manual, and understand that my result is returned as a 10-bit number in ADRESH:ADRESL, and i've set up a routine which does certain things depending on what range the value in these registers are. What I havent yet been able to figure out, and i've checked the manual so perhaps i'm missing something obvious, is how the value in ADRESH:ADRESL translates into a voltage? Does it translate into an absolute voltage? ie does a result of B'0000010000' (decimal 16) translate to 1.6v? (or wherever the decimal point might be) Or is it more a case of B'1111111111' represents VREF+? and B'0000000000' represents VREF- and anywhere in between is a fractional step up towards VREF+? Or is it something else? Thank you kindly for any advice Mark |
#2
Posted to sci.electronics.design,alt.electronics,sci.electronics.components,sci.electronics.misc
|
|||
|
|||
Need advice on using the PIC 18F1320's AD converter
Spehro Pefhany wrote:
Be sure to check out document DS39527A (PIC18C reference manual) and the section covering the ADC. It will help answer these questions and more. Does it translate into an absolute voltage? ie does a result of B'0000010000' (decimal 16) translate to 1.6v? (or wherever the decimal point might be) Or is it more a case of B'1111111111' represents VREF+? and B'0000000000' represents VREF- and anywhere in between is a fractional step up towards VREF+? Yes, close to this. Best regards, Spehro Pefhany Thanks, i've dug out the reference manual, never knew this document existed. Either way, I think you've answered my question perfectly, I can't thank you enough spehro! Regards, Mark |
#3
Posted to sci.electronics.design,alt.electronics,sci.electronics.components,sci.electronics.misc
|
|||
|
|||
Need advice on using the PIC 18F1320's AD converter
On Fri, 28 Jul 2006 22:02:29 +0100, the renowned Mark Fortune
wrote: Hi all, I am doing a project for someone that involves using the A/D converter on a PIC18F1320 microcontroller. I believe I have it all licked, apart from I just cannot figure out how to use the A/D converter properly. This is my first experience with microcontrollers, so please forgive my ignorance if this seems like a basic problem. I have a sensor on AN0, which outputs a voltage anywhere between 0.4v and 2.75v - which is what I want to read so the chip can determine what is going on in the outside world. Now i'm using AVdd/AVss as a voltage reference - which i've interpretted as meaning it uses the + and - power supply to the chip.. which incidently is a regulated 5v supply powered off a 9v battery. I've set the configuration to what I believe is correct, the chip will be operating at 1MHz and i've used an acquisition time of 8TAD, set the A/D converter up as specified in the manual, and understand that my result is returned as a 10-bit number in ADRESH:ADRESL, and i've set up a routine which does certain things depending on what range the value in these registers are. What I havent yet been able to figure out, and i've checked the manual so perhaps i'm missing something obvious, is how the value in ADRESH:ADRESL translates into a voltage? Ideally the ADC will read 0x000 when the input volage is less than Vref- + 1/1024* (Vref+ - Vref-) and 0x3FF when the input voltage is greater than 1023/1024 * (Vref+ - Vref-) + Vref- . So, if your references are 0V and 5V, and you have a reading of 0x10 (decimal 16) then (ideally) the input is somewhere between 0.0757V and 0.0806V (if I got the numbers right..) the range is calculated from 15.5 to 16.5 divided by 1024 times the reference high, (assuming the reference low is zero). Be sure to check out document DS39527A (PIC18C reference manual) and the section covering the ADC. It will help answer these questions and more. Does it translate into an absolute voltage? ie does a result of B'0000010000' (decimal 16) translate to 1.6v? (or wherever the decimal point might be) Or is it more a case of B'1111111111' represents VREF+? and B'0000000000' represents VREF- and anywhere in between is a fractional step up towards VREF+? Yes, close to this. Or is it something else? Thank you kindly for any advice Mark Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com |
#4
Posted to sci.electronics.design,alt.electronics,sci.electronics.components,sci.electronics.misc
|
|||
|
|||
Need advice on using the PIC 18F1320's AD converter
Mark Fortune wrote:
Hi all, I am doing a project for someone that involves using the A/D converter on a PIC18F1320 microcontroller. I believe I have it all licked, apart from I just cannot figure out how to use the A/D converter properly. This is my first experience with microcontrollers, so please forgive my ignorance if this seems like a basic problem. I have a sensor on AN0, which outputs a voltage anywhere between 0.4v and 2.75v - which is what I want to read so the chip can determine what is going on in the outside world. Now i'm using AVdd/AVss as a voltage reference - which i've interpretted as meaning it uses the + and - power supply to the chip.. which incidently is a regulated 5v supply powered off a 9v battery. I've set the configuration to what I believe is correct, the chip will be operating at 1MHz and i've used an acquisition time of 8TAD, set the A/D converter up as specified in the manual, and understand that my result is returned as a 10-bit number in ADRESH:ADRESL, and i've set up a routine which does certain things depending on what range the value in these registers are. What I havent yet been able to figure out, and i've checked the manual so perhaps i'm missing something obvious, is how the value in ADRESH:ADRESL translates into a voltage? Does it translate into an absolute voltage? ie does a result of B'0000010000' (decimal 16) translate to 1.6v? (or wherever the decimal point might be) Or is it more a case of B'1111111111' represents VREF+? and B'0000000000' represents VREF- and anywhere in between is a fractional step up towards VREF+? Or is it something else? Thank you kindly for any advice Mark its a scale of the Vdd normally or close to it. you have to check the specs on the input when in use it for ADC . it will tell you the range of voltage it handles in the ADC mode. this range translates from 0...max number value of the 10 bit binary range. but like i said, i have seen some where the input has to be like 2.5 volts min and it only spans to 5.0 volts. this means you have only 2.5 volts spanned. a 10 bit value 0..2^10 value will report this. if this PIC require a min voltage as i indicated you will need to consider that when tailoring the input.. -- Real Programmers Do things like this. http://webpages.charter.net/jamie_5 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sheetmetal/Metalfab equipment advice needed | Metalworking | |||
Two stage update to old central heating system - expert advice please | UK diy | |||
New build property – insulation & heating advice | UK diy | |||
Cutback on plywood and new vinyl tile, need advice. | Home Repair | |||
Advice wanted on static self starting phase converter for a 2HP motor. | Metalworking |