ADC10bit data only show 8bit data in hyperterminal

Status
Not open for further replies.

ong_yc79

Newbie level 1
Joined
Jan 4, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Malaysia
Activity points
1,291
Hi All,

I am trying to measure the analog voltage in PIC16F877A. 10 bit data was used for ADC conversion. However, after transmission via serial port, it only shows 8bit data in hyperterminal. Please help

volatile unsigned int ADC_VALUE;

/* Selecting ADC channel */
ADCON0 = (ADC_Channel << 3) + 1;
ADIE = 0;
ADIF = 0;
ADRESL = 0;
ADRESH = 0;

ADGO = 1; /* Staring the ADC process */
while(!ADIF) continue; /* Wait for conversion complete */

ADC_VALUE = ADRESL; /* Getting HSB of CCP1 */
ADC_VALUE += (ADRESH << 8);
return (ADC_VALUE); /* Return the value of the ADC process */
}



void main(void)
{
OPTION=0xFF;
CLRWDT();
serial_setup();
InitialiseADC(0);

putst("\n\n\nInfra Red Distance Mesurement V0.1\n");
putst("Command List:\n");
putst("m - Measure Distance\n");
putst("Start... \n");
char getch_timeout_temp;
for(;
{
getch_timeout_temp=getch_timeout();
if (getch_timeout_temp=='m')
{
int Voltage = ReadADC(0);
putst("RESULT=");
putchdec(Voltage);
putst("\n\r");
}
}
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…