## 1820Re: [booksbybibin,www.booksbybibin.tk] Re: HAVING PROBLEM WITH ADC

Expand Messages
• Aug 16, 2009
You can use this for float to char: (didn't test for int)

void aff_float(float number) //afficher float avec 1 decimal

{

unsigned char aff[16];

sprintf(aff,"%.1f",number);

aff_data(aff);

}

void aff_data(unsigned char data[])

{

PORTB |= (1 << 2);                //RS=1; //envoie un octet de donnée.

for(int i=0;i<strlen(data);i++)

{

aff_char(data[i]);

}

}

void aff_char(unsigned char caracter)

{

PORTB |= (1 << 2);                //RS=1; //envoie un octet de donnée.

PORTC=caracter;

enable();

_delay_ms(5);

}

From: nitin chaudhary <nitin2162000@...>
To: booksbybibin@yahoogroups.com
Sent: Saturday, August 15, 2009 1:11:55 AM
Subject: Re: [booksbybibin,www.booksbybibin.tk] Re: HAVING PROBLEM WITH ADC

If you want to display the result on lcd connected to the microcontroller then you have to convert int in to char as lcd takes character. If your result is 201 the algo is
for (i=0;i<2;i++)
{
y=x%10;
z='0';
for(j= 0; j<=9; j++)
{
if(y==j)
{
lcdprint(z);
break();
}
else
z+=1;
}
x=x/10;
}
I am in hury so plze consider it before usage (it is simply int to char conversion);
best of lck......... ....
--- On Thu, 13/8/09, Saeed Ahmed <danial_1000@ yahoo.com> wrote:

From: Saeed Ahmed <danial_1000@ yahoo.com>
Subject: Re: [booksbybibin, www.booksbybibin .tk] Re: HAVING PROBLEM WITH ADC
To: booksbybibin@ yahoogroups. com
Date: Thursday, 13 August, 2009, 7:46 AM