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 support@ccsinfo.com

transfering data to LCD via I2C

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 17, 2006 1:49 pm     Reply with quote

Use printf to convert to ASCII. Use the re-direction feature of the CCS
printf() function to send the output to your lcd driver. Example:

Code:

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
//#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#include <lcd.c>

//===============================
void main()
{
float value;

lcd_init();

value = 1.243;

printf(lcd_putc, "%7.3f", value);

while(1);
}
croc4



Joined: 02 Sep 2005
Posts: 10

View user's profile Send private message

Thank you!!!
PostPosted: Fri Mar 17, 2006 2:11 pm     Reply with quote

Thanks, the printf, did the trick. I didn't know you could do that, I have a lot to learn.

Thanks again,

Croc4
gs



Joined: 22 Aug 2005
Posts: 30
Location: Ioannina - Greece

View user's profile Send private message Visit poster's website

PostPosted: Sat Mar 18, 2006 7:52 pm     Reply with quote

You could also multiply with 1000 and print the result as 1000's,".",100's,10's,1's

If you want to avoid use of floats you could modify the calculations this way.
_________________
www.hlektronika.gr
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