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

Hi everyone

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



Joined: 12 Apr 2004
Posts: 14

View user's profile Send private message

Hi everyone
PostPosted: Tue May 18, 2004 6:04 am     Reply with quote

I am trying to make an interface between the PC and a pic using the max232a chip
I wonder about my code.
i know what should the command for such a thing be but i would like some help for the printf that i should use(positioning if it should be outside or inside my main loop) and (an example of the printf if it is to print 2 float numbers values)
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Tue May 18, 2004 7:11 am     Reply with quote

printf() is typically re-entrant for any compiler so it should not appear in interrupt service routines. It is OK for use in main() or a subroutine.

Code:

printf("Hello world, the numbers are %f and %e\r\n", fnum1, fnum2);


The first number, fnum1 will print as a "standard" floating point while fnum2 will print using exponential format. You can modify the %f or %e to change the number of decimal points and field width. Refer to a C language reference such as K & R's book.

The CCS help file gives some simple examples, especially if you need to see how to use streams.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
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