Hi all,

I am in a situation where I need to read ADC value and display it in LCD. Im using PIC18F4620. I have interfaced the LCD with the PIC and it can display normal strings very well. But I have been caught in a difficult situation when I try to read an analog value and display it in my LCD. This is my simple code:

// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections



int temp;


void main() {
TRISB = 0; //PORTB as output
TRISA = 0xFF; //PORTA as input
ADCON1 = 0x7A; // Configure all ports with analog function as digital except RA2
CMCON |= 7; // Disable comparators
Lcd_Init(); //Initialize LCD

while (1){
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
temp = 5000*ADC_Read(2)/1023;


Lcd_Out(1, 1, temp);
Delay_ms(500);
}
}

There are few problems here. I am not sure what value will the variable 'temp' have. When I use the function LCD_Out, I get a warning that reads: "Implicit conversion of int to ptr" and the LCD would show a string of funny symbols. When I use LCD_Chr, it doesnt give any warning, but I only get to see a single numeric character on the display. Furthermore, I am not sure if I should convert temp from hex to decimal or binary to decimal since I am not sure the nature of the read value. Please help me on this, thanks in advance. Your suggestions/opinions are much much anticipated.