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

getc? putc?how do u use it?

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



Joined: 27 Nov 2005
Posts: 29

View user's profile Send private message MSN Messenger

getc? putc?how do u use it?
PostPosted: Wed Feb 08, 2006 8:04 am     Reply with quote

im sorry but im a little confuse on how to use the getc and putc...
what if i want a PIC to send data to use putc...and the other PIC get the data to use getc?isit possible? i read the last forum but still didnt get the right one...anyone please?
rwyoung



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

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

PostPosted: Wed Feb 08, 2006 8:23 am     Reply with quote

From the on-line help file (and probably the same text in the PDF manual):

getc()
Quote:
This function waits for a character to come in over the RS232 RCV pin and returns the character. If you do not want to hang forever waiting for an incoming character use kbhit() to test for a character available. If a built-in USART is used the hardware can buffer 3 characters otherwise GETC must be active while the character is being received by the PIC�.


putc()
Quote:
This function sends a character over the RS232 XMIT pin. A #USE RS232 must appear before this call to determine the baud rate and pin used. The #USE RS232 remains in effect until another is encountered in the file.


So getc() receives and putc() transmits.

If you are still having problems I suggest you borrow or buy a copy of "The C Language" 2nd ed. by Kernighan and Ritchie.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
crushneck



Joined: 27 Nov 2005
Posts: 29

View user's profile Send private message MSN Messenger

PostPosted: Thu Feb 09, 2006 11:39 am     Reply with quote

can u give an example on how to use it? like one for putc() and the other one is for getc() only? Because i wanna use it for pic 2 pic comnication.
rwyoung



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

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

PostPosted: Thu Feb 09, 2006 11:55 am     Reply with quote

crushneck wrote:
can u give an example on how to use it? like one for putc() and the other one is for getc() only? Because i wanna use it for pic 2 pic comnication.


Did you go look at the manual at all? The entry for putc() has an example as does the entry for getc(). There is even an complete example program installed with the compiler, ex_tgetc.
_________________
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