problem

Here you can find latest news on mikroElektronika products.
Post Reply
Author
Message
gsim
Posts: 5
Joined: 19 Aug 2015 13:14
Location: china

problem

#1 Post by gsim » 27 Aug 2015 08:38

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) ;

}

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: problem

#2 Post by Aleksandar.Mitrovic » 27 Aug 2015 11:27

Hi,

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

Regards,
Aleksandar

Post Reply

Return to “Product Announcements”