Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Temperature Decimal Point Value on LCD

Status
Not open for further replies.

RannieKnows

Junior Member level 1
Joined
Sep 9, 2014
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
107
Good day!

I was able to produce temp value on the LCD by having multiplier on RA2 (ADC) such that 255 value is equal to 100degCelsius. My problem is, for example I inputted 128 on RA2, the LCD produced 50 instead of 50.something. In short, how will the LCD show the decimal point value of the temperature with respect to the input analog signal?

Thanks. I've read other related articles and they used different prog lang.

Please help me.

- - - Updated - - -

I'm using MIKROBASIC. MicroC is PIC16F877A
 

Use FloatToStr() function to get what you want. Please Zip and post mikroBasic project files so that it can be modified as you need.
 

View attachment Temperature.rar

This is my assignment.

We are asked to output temperature depending on AN2 such that 0=0degreeC, 128=50degC, and 255=100degC.

My problem is that, when I input 127 on AN2. The expected output must be 49.80 but the LCD output is just 49.

Thanks in advance.
(Saw your file ADC. It seemed to be applicable only to decimal point but not when the answer both include whole number and dec point. I'm not professional yet so i don't know what really happened aside from it posted the decimal point value of example: 1 = 0048 because it's 4.8x10^-3 in Calculator)
 

The ADC on PIC16F877A is 10bit and it gives 1023 for 5V adc input and 0 for 0V. What Temperature Sensor are you using ? Please provide circuit.
 

Yes it gives 1023 for 5V, but still, we are asked to output 100degC on 255 value. I'm only doing a simulation and sensor is not needed. Values are inputted manually on PicSim.
 

Here is another version which shows 100 deg C for 255 raw adc value. Enter 255 and see if it gives 100.

- - - Updated - - -

Here is a better code.

when adc value is 255, temperature = 255 / 2.55 = 100


Code C - [expand]
1
2
3
4
5
6
while true
        temperature = ADC_Read(2) / 2.55
        FloatToStr(temperature,text)
        Lcd_Out(2,1,text)
 
    wend

 

Attachments

  • Temperature rev2.rar
    83.8 KB · Views: 99
Thanks a lot!
You've given me a big help, Milan.Rajik!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top