Thanks to the help I got from this forum I have successfully managed to communicate via a 16F628 pic to my PC with RS232. I can now transmit data and read it using hyperterminal. The next thing I want to do is transmit data from PC to PIC. I can easily use VB to send data. The thing is how does the PIC present the data it has recieved? Say I sent a chracter to the PIC via RS232, where can it be read on the PIC. Does the UART put it in a register somewhere? If so what is the command to read the register?
Many thanks
Matt
Sherpa Doug Guest
Posted: Sat Feb 19, 2005 12:59 pm
Just like you can use putc() to send a character, you use getch() to receive a character. Note that by default getch() will wait for the character. If no character arrives it will wait forever. So call kbhit() first to see if there is a character to be received.
Read about getch() and kbhit() and many of your quaestion will be answered.
Sherpa Doug
younus_noman
Joined: 04 Jul 2005 Posts: 9
getchar
Posted: Mon Jul 04, 2005 2:01 pm
I am trying to receive data serially over RS-232 through LAB VIEW.
Lab view sends 3 bytes plus a termination character (0D ) at the end to PIC16f876 controller. Some how i am not able to read that termination character (0D) using getc().
Is it necessary for me to send a carriage return and a line feed at the end to read the 4th termination character?
Any ideas?
Noman Younus
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
Posted: Mon Jul 04, 2005 2:18 pm
Nope, getc() should read it just fine. You might have a problem if you were using gets() though.
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