CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

printf... this is sad :(

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ljbeng



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

printf... this is sad :(
PostPosted: Fri Oct 06, 2006 8:19 am     Reply with quote

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







PostPosted: Fri Oct 06, 2006 8:32 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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