سلام دوستان
کسی میدونه چرا این برنامه کار نمیکنه؟
اگه float رو به int
و f% رو به d% تغییر بدم جواب 12 روی LCD چاپ میشه. ولی من میخوام اعشاری محاسبه کنه و 4.1152263 رو روی LCD چاپ کنه.
[code=c]
#include <mega128a.h>
#include <stdio.h>
#include <stdlib.h>
#include <lcd.h>
#asm
.equ __lcd_port = 0x1B // LCD: Port A
#endasm
/******************** Main Function *******************/
void main()
{
char str1[]="12.3456789";
float A;
char str2[];
lcd_init(16);
lcd_clear();
lcd_gotoxy(0,0);
A=atof(str1);
A=A/3;
sprintf(str2,"%f",A);
puts(str2);
lcd_puts(str2);
}
[/code]
کسی میدونه چرا این برنامه کار نمیکنه؟
اگه float رو به int
و f% رو به d% تغییر بدم جواب 12 روی LCD چاپ میشه. ولی من میخوام اعشاری محاسبه کنه و 4.1152263 رو روی LCD چاپ کنه.
[code=c]
#include <mega128a.h>
#include <stdio.h>
#include <stdlib.h>
#include <lcd.h>
#asm
.equ __lcd_port = 0x1B // LCD: Port A
#endasm
/******************** Main Function *******************/
void main()
{
char str1[]="12.3456789";
float A;
char str2[];
lcd_init(16);
lcd_clear();
lcd_gotoxy(0,0);
A=atof(str1);
A=A/3;
sprintf(str2,"%f",A);
puts(str2);
lcd_puts(str2);
}
[/code]
دیدگاه