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
Posted: Wed Feb 08, 2006 8:23 am
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
Posted: Thu Feb 09, 2006 11:39 am
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
Posted: Thu Feb 09, 2006 11:55 am
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!
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