i have meet some problem with my coding in which my ADconverter output program shows the output in 7 segmant in hexadecimal number, but i want in the decimal number...can somebody help me to check my coding how to convert the hexa to decimal output?
View attachment 63749
and my coding
#include <P18F4550.h>
void delay1s(unsigned char);
void main(void)
{
TRISB=0;
TRISAbits.TRISA0=1;
PIR1bits.ADIF=0;
PIE1bits.ADIE=1;
INTCONbits.PEIE=1;
INTCONbits.GIE=1;
ADCON0=00000001;
ADCON1=00001110;
ADCON2=10100101;
ADCON0bits.ADON=0x01;
while(1)
{
ADCON0bits.GO=1;
while(ADCON0bits.DONE==1);
PORTB=ADRESL;
delay1s(1);
}
}
void delay1s(unsigned char nsecond)
{
unsigned char x, y;
for(x=0;x<nsecond;x++) //Total delay
for(y=0;y<200;y++); //No.of loop to generate 1 second delay
}
View attachment 63749
and my coding
#include <P18F4550.h>
void delay1s(unsigned char);
void main(void)
{
TRISB=0;
TRISAbits.TRISA0=1;
PIR1bits.ADIF=0;
PIE1bits.ADIE=1;
INTCONbits.PEIE=1;
INTCONbits.GIE=1;
ADCON0=00000001;
ADCON1=00001110;
ADCON2=10100101;
ADCON0bits.ADON=0x01;
while(1)
{
ADCON0bits.GO=1;
while(ADCON0bits.DONE==1);
PORTB=ADRESL;
delay1s(1);
}
}
void delay1s(unsigned char nsecond)
{
unsigned char x, y;
for(x=0;x<nsecond;x++) //Total delay
for(y=0;y<200;y++); //No.of loop to generate 1 second delay
}