Hello, I have a 10 bit analog to digital binary result storred in an array called:
Code:
unsigned char outString[20];
I would like to convert this to an int to use in an if statement:
Code:
if(outString >= 51)
But when I compile my program (Hi-Tech PICC) I get the error "operands of >= not same type". How would I perform this conversion??
Basically I have code that takes this 10 bit binary value and ouputs the corresponding int number to my LCD. I would like to take that number and compare it with another number before it prints. My code is the following:
Code:
main()
{
int adcvalue, n;
unsigned char outString[20];
n=0;
TRISA=0x05;
lcd_init();
init_a2d();
LCDclear();
while(n==0)
{
ADGO=1;
while(ADGO)continue;
ADIF=0;
adcvalue=(ADRESH<< 8) + ADRESL;
sprintf(outString,"%d",adcvalue);
if(outString >= 51)
{
LCDwritestring("98%");
ADON=0;
n=1;
}
}
for(;;);
}
Thank you.