thank you very much for replying Aleksandar.Mitrovic :
the compiler mikroc pro for avr and mcu atmega16 .
sorry i forget to mention that.
showing float in usart1 mikroc pro avr
Re: showing float in usart1 mikroc pro avr
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) ;
}
this my question but i found the answer that i am using proteus for simulation and proteus is not compatible with mikroc pro for avr compiler when i run it in real time there is no problem
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) ;
}
this my question but i found the answer that i am using proteus for simulation and proteus is not compatible with mikroc pro for avr compiler when i run it in real time there is no problem
- aleksa.jovanovic
- Posts: 526
- Joined: 30 Jun 2015 08:48
Re: showing float in usart1 mikroc pro avr
Hi,
I've tried uploading this example to PIC18F45K22 and it outputs the correct value on the USART terminal.
Best regards,
ALeksa
I've tried uploading this example to PIC18F45K22 and it outputs the correct value on the USART terminal.
Best regards,
ALeksa