Page 1 of 1

problem

Posted: 27 Aug 2015 08:38
by gsim
hi every one :
for more than three days i failed to solve this problem my problem is how to make this divition 1 or 2 /255 and show the result in usart all the times the result was wrong please help my. thanx in advance.
this my cod .

float per;
char per_txt[15] ;

void main(){
UART1_Init(9600);
per=(float)1/(float) 255;
floattostr(per,per_txt);
//UART1_Write_text(per_txt); //the result was w.215682e-4 allways is wrong sometimes h or g with number
sprintf(per_txt, "%12f",per); //also i used this and the result was -0.963375
UART1_Write_text(per_txt) ;

}

Re: problem

Posted: 27 Aug 2015 11:27
by Aleksandar.Mitrovic
Hi,

I believe that I answered you here:
http://www.mikroe.com/forum/viewtopic.p ... 17#p261817

Regards,
Aleksandar