its default .......16 mhz
whole code is this
#include <p18f4580.h>
#pragma config WDT = OFF
#pragma config OSC= IRCIO67
#pragma config PWRT=ON
#pragma config LVP=OFF
#define ldata PORTD
#define rs PORTBbits.RB0 //define reset bit
#define rw PORTBbits.RB1 //define read/write bit
#define en PORTBbits.RB2 //define enable bit
void lcdcmd (char value);
void lcddata(char value);
void MSDelay(int itime);
rom float V[9]={3.31,3.32,3.33,3.35,3.34,3.36,3.38, 3.37,3.39};
rom float I[8]={0,5,6,16.69,3.94,3,3, 32.44};
rom float R[9]={0,1.1,1.21,1.37,1.32,1.50,1.35,1.6,1};
void main (void)
{
int volt,volt2,volt3, volt4;
unsigned int hold, xlow,xhigh,xchange, word;
signed float y,z,V1,v2,v4,x1,a,v10;
signed int m,n,ones,V2,tenth,twos,b,v3,v5,V3,q,t,x;
signed float I1,T,V6,p,voltf;
TRISB=0x00; //PORT B as output
TRISD=0x00; //PORT D as output
OSCCON = 0x70;
ADCON0 = 0x01; //0000 0001,channel 0(AN 0),A/D is ON.
ADCON1 = 0x0E; //0000 1110,AN0 is analog i/p, use Vdd & Vss as refs.
ADCON2 = 0x9D; //Right justified, 6Tad acquisition time, Fosc/16.
PORTA = 0x00; //Clear PORT A
PORTD = 0x00; //clear PORT D
en = 0;
MSDelay(100);
lcdcmd(0x38); //initiate LCD 2 lines and 5x7 matrix
while(1)
{
lcdcmd(0x0E); // display and cursor ON.Writing 0x0F makes the cursor blink
MSDelay(15); //delay
lcdcmd(0x01); // this is to clear LCD
MSDelay(15);
lcdcmd(0x06); // shift the cursor to right
MSDelay(15);
lcdcmd(0x80); //line 1, position 0
MSDelay(1);
ADCON0bits.GO = 1; //start conversion
while(ADCON0bits.DONE == 1); //wait for DONE bit to go low
xlow = ADRESL; //assign the lower 8 bits to a variable
xhigh = ADRESH;//assign the higher 2 bits to another variable
xchange = xhigh<<8; //shift left by 8 bits
hold = xchange|xlow; // OR the final bytes.
printf("hold = %u \n",hold); //just to check the output, is 0.
volt = (5*hold/1023)+48; //Vcc=5V, Dout*stepsize = Vin,catch the first digit
volt2 = (50*hold/1023)%10+48; //catch the first decimal
volt3 = (500*hold/1023)%10+48; //20/41 =~ 500/1024, catch the second decimal
/////////PRINT THE COLLECTED DATA ON LCD///////////////////
lcddata(volt);
MSDelay(15);
lcddata('.');
MSDelay(15);
lcddata(volt2);
MSDelay(15);
lcddata(volt3);
MSDelay(15);
lcddata(86);
MSDelay(500);
lcdcmd(0x89);
x=volt*100;
//x=(int)x;
//lcddata(x+48);
y=volt2*10;
//y=(float)y;
//y = y * 10;
//lcddata(y+48);
z=volt3;
//z= z*100;
//z=(float)z;
//lcddata(z+48);
//V1=(float)2.00;
V1=(x+y+z)-527;
//V1=(float)336;
//x1 = V1-527;
//V1=(float)x1 ;
v2=(float)V1/100;
v3=(int)v2;
lcddata(v3);
MSDelay(15);
lcddata('.');
V6=(float)(v2-v3);
V6 = V6 * 10;
//V6 = V6-2;
lcddata(V6+0X30);
MSDelay(15);
v4=(int)(V6);
V6 = (float)(V6-v4);
v5 =V6 * 10;
v5=(int)(v5);
//v5=v5 + 48;
lcddata(v5+0X30);
lcdcmd(0xC0);
MSDelay(15);
for(m=0;m<=10;m++)
{
if( v2==V[m]){
p=(float)R[m] ;
q= (int)p ;
v2=(float)p/10;
lcddata(p+0X30);
v3=(int)v2;
v2 -= v3;
v2 *= 10.0;
b=(int)(v2);
a= b + 48;
lcddata(a);
MSDelay(15);
break;
MSDelay(15);
}
}
MSDelay(10000);
}
}
void lcdcmd(char value)
{
ldata = value; // put the value on the pins of PORTD
rs = 0;
rw = 0;
en = 1; // strobe enable pin
MSDelay(1);
en = 0;
}
void lcddata (char value)
{
ldata = value; //put the value on the pins of PORTD
rs = 1;
rw = 0;
en = 1; // strobe enable pin
MSDelay(1);
en = 0;
}
void MSDelay(int itime)
{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0;j<135;j++);
}