KhaledOsmani
Full Member level 6
- Joined
- May 4, 2014
- Messages
- 384
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 18
- Activity points
- 3,933
It Looks like I have a misunderstanding in ADC process inside a PIC microcontroller.
If I want to read an Analog value (voltage) from a sensor, and convert it to decimal:
Assume an LM35DZ sensor, is powered up, and connected to a PIC circuit, where its output is connected to PORTA.0
It either has an analog output of 0 to 5V.
The ADC here is of 10bits.
So in decimal it would be from 0 to 1024 (2^10)
Assume that the conversed decimal value of this input (RA0) is put into temporary variable in a file register, labeled X for example,,
What I saw on the internet was that this X must be multiplied by the factor of 0.4887
This constant is got from 5000/1023, then it said that the actual value must be divided by 10, so 500/1023 = 0.4887
because every 10mV = 1 degree, so if we divide the above answers by 10 we will have the temperature in degree’s Celsius.
So TEMP = X * 0.4887
PROBLEM STATEMENT: I am not receiving an accurate output on the LCD, about the temperature, I also am not noticing any changes in the output, when presenting the sensor to extreme temperature fluctuations, i.e bringing ice boxes near to it, or closing a lighter next to it.
What are my wrong concepts about this title (ADC)? What are the issues, and How I can have dynamic representation of accurate temperature changes, when fronting the LM35DZ circuit to different temperature conditions?
Is the formulae of TEMP correct?
If I want to read an Analog value (voltage) from a sensor, and convert it to decimal:
Assume an LM35DZ sensor, is powered up, and connected to a PIC circuit, where its output is connected to PORTA.0
It either has an analog output of 0 to 5V.
The ADC here is of 10bits.
So in decimal it would be from 0 to 1024 (2^10)
Assume that the conversed decimal value of this input (RA0) is put into temporary variable in a file register, labeled X for example,,
What I saw on the internet was that this X must be multiplied by the factor of 0.4887
This constant is got from 5000/1023, then it said that the actual value must be divided by 10, so 500/1023 = 0.4887
because every 10mV = 1 degree, so if we divide the above answers by 10 we will have the temperature in degree’s Celsius.
So TEMP = X * 0.4887
PROBLEM STATEMENT: I am not receiving an accurate output on the LCD, about the temperature, I also am not noticing any changes in the output, when presenting the sensor to extreme temperature fluctuations, i.e bringing ice boxes near to it, or closing a lighter next to it.
What are my wrong concepts about this title (ADC)? What are the issues, and How I can have dynamic representation of accurate temperature changes, when fronting the LM35DZ circuit to different temperature conditions?
Is the formulae of TEMP correct?