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.

How do i display decimal point on the resulting temperature?

Status
Not open for further replies.

vanvan00

Newbie level 6
Joined
Nov 13, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,366
how do i display decimal point on the resulting temperature with my Lm35 temperature circuit? Im using Pic18F452 microcontroller my code is below thanks alot

unsigned temp_value;
char out[6];

void main() {
ADCON1 = 0x80;
TRISA = 0xFF; // PORTA as input
TRISB = 0x00; // PORTB as ouput
Lcd_Init(&PORTB);
Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Out(1,1,"Temperature is:");


do {
temp_value = (Adc_Read(0)/2); // Read analog input
WordToStr(temp_value,out);
Lcd_Out(2,10,out);
Lcd_Chr_Cp(223);
Lcd_Chr_Cp('C');
delay_ms(2500); // Sample at 2.5 sec
} while(1);
}
 

use sprintf function
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top