hi,,,,
am new to this forum... and new to microcontroller also... can anyone pls help me... am working with pic18f4550 to get the analog input in AN0 pin and to display it in hyperterminal screen...
now my problem is am getting values like this "00000001112121162225263335363745454849505050" in hyperterminal screen... i tired some functions but am not getting in float values...
please help me for this.... i don know what to do....
am waiting for ur replies....
here is my code..
void ReadPOT(void)
{
ADCON0bits.GO = 1; // Start AD conversion
while(ADCON0bits.NOT_DONE); // Wait for conversion
return;
}//end ReadPOT
void SendADC(void)
{
int temp;
float advalue;
counter++;
if (counter==10000)
{
counter=0;
ReadPOT();
input_buffer[0] = ADRESH;
input_buffer[1] = ADRESL;
if(mUSBUSARTIsTxTrfReady())
{
temp = ReadADC();
if(mUSBUSARTIsTxTrfReady())
{
itoa(advalue,input_buffer);
mUSBUSARTTxRam((byte*)input_buffer,2);
}
}
}
}
am new to this forum... and new to microcontroller also... can anyone pls help me... am working with pic18f4550 to get the analog input in AN0 pin and to display it in hyperterminal screen...
now my problem is am getting values like this "00000001112121162225263335363745454849505050" in hyperterminal screen... i tired some functions but am not getting in float values...
please help me for this.... i don know what to do....
am waiting for ur replies....
here is my code..
Rich (BB code):
{
ADCON0bits.GO = 1; // Start AD conversion
while(ADCON0bits.NOT_DONE); // Wait for conversion
return;
}//end ReadPOT
void SendADC(void)
{
int temp;
float advalue;
counter++;
if (counter==10000)
{
counter=0;
ReadPOT();
input_buffer[0] = ADRESH;
input_buffer[1] = ADRESL;
if(mUSBUSARTIsTxTrfReady())
{
temp = ReadADC();
if(mUSBUSARTIsTxTrfReady())
{
itoa(advalue,input_buffer);
mUSBUSARTTxRam((byte*)input_buffer,2);
}
}
}
}
Rich (BB code):