View previous topic :: View next topic |
Author |
Message |
Georg Prinz
Joined: 07 Jan 2004 Posts: 22 Location: Frankfurt, Germany
|
Problemos LCD |
Posted: Mon Dec 05, 2005 10:18 am |
|
|
Hi folks,
could anybody give me a solution for this problem:
Writing to a LCD like printf(lcd_putc,"\f Power=%4.0f dBm",floatvalue) will change the position with the size of the variable. This leads to the unwanted situation that the number is jumping around depending on the number of characters from one to four. I don't like to use leading zeros (%04.0f), because this is not comfortable to read.
Thanks in advance
Saludos
Jorge |
|
|
Georg Prinz
Joined: 07 Jan 2004 Posts: 22 Location: Frankfurt, Germany
|
problemos lcd |
Posted: Mon Dec 05, 2005 2:34 pm |
|
|
to complete my question: I'am using PCWH, Rev. 3.212
Saludos
Jorge _________________ dl 2 kp |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah Guest
|
|
Posted: Mon Dec 05, 2005 3:45 pm |
|
|
It ought to work on the currentish versions (3.236). There were problems with the float number justification, till a few versions ago, and 3.212, has these, requiring you to use a 'bodge around' as outlined...
On 3.236, the number correctly justifies with the leading spaces.
It might be worth checking if the integer output has the same problem. Given you are not using anything after the DP, if you used:
printf(lcd_putc,"\f Power=%4Ld dBm",(int16)floatvalue)
It is just possible it might wk.
Best Wishes |
|
|
Georg Prinz
Joined: 07 Jan 2004 Posts: 22 Location: Frankfurt, Germany
|
|
Posted: Tue Dec 06, 2005 5:16 am |
|
|
Thank you both javascript:emoticon('')! It`s working now, even with characters after the decimal point, multiplying by hundred and converting it to integer. Well, I'am not happy with loosing lot of cycles, but it helps.
Saludos
Jorge _________________ dl 2 kp |
|
|
|