[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Problems with float numbers

From: Jose Javier Segura Juarez
Subject: [avr-gcc-list] Problems with float numbers
Date: Wed, 29 Jun 2005 14:19:07 +0200
User-agent: Internet Messaging Program (IMP) 3.2.6

Dear AVR programmers community. This is the first time i write to this mail
I am trying to generate a pulse with modulation with the timer1 of the
The problem resides when i try to do an operation like

uint8_t percent=50;
char buff[17];

OCR1AH = (0x400 * percent / 100) >> 8;
OCR1AL = (0x400 * percent / 100);
sprintf(buff, "PWM: %d %f", percent, 1.0);

lcd is a pointer to an object controlling a 2x16 character lcd.
The problem is that lcd prints ? instead 1.0. The rest of text is printed well.
I linked math and printf_flt librabries but the problem persist.
I think the problem resides in the float treatment by sprintf.
I want to make a motor control application.

Can somebody help me?

Jose Segura

reply via email to

[Prev in Thread] Current Thread [Next in Thread]