|
|
View previous topic :: View next topic |
Author |
Message |
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
printf... this is sad :( |
Posted: Fri Oct 06, 2006 8:19 am |
|
|
FYI
I compared two different ways to display data to the lcd, one using the %w command and the other using the ldiv command. There is a huge difference in how long it take to print the data to the lcd. The %w takes 40ms at 4.096Mhz to print 32 characters to the lcd. The ldiv takes 4ms to print 32 characters. This has been a nightmare. I have to go back through 3 programs and change them back to ldiv. I will send this off to CCS as well. Thanks.
Code: | output_high(a1);
printf(lcd_putc,"\t%04.2w ",fwdepth);
printf(lcd_putc,"\b%04.2w ",rvdepth);
output_low(a1);
output_low(a2);
delay_ms(100);
output_high(a1);
result = ldiv(fwdepth,100);
printf(lcd_putc,"\t%01ld.%02ld ",result.quot,result.rem);
result = ldiv(rvdepth,100);
printf(lcd_putc,"\t%01ld.%02ld ",result.quot,result.rem);
output_low(a1);
output_low(a2);
delay_ms(100); |
|
|
|
Ttelmah Guest
|
|
Posted: Fri Oct 06, 2006 8:32 am |
|
|
The key difference, is that 'ldiv', only supports 15bit integers, while %w, internally uses int32.
ldiv, is the faster solution, provided you are only using smaller values.
%w, comes into it's own for people who want to (say), use values like 10000.00.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|