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

Dealing with recieved data from RS232

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



Joined: 11 Feb 2005
Posts: 11

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

Dealing with recieved data from RS232
PostPosted: Sat Feb 19, 2005 10:00 am     Reply with quote

Hi,

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







PostPosted: Sat Feb 19, 2005 12:59 pm     Reply with quote

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

View user's profile Send private message

getchar
PostPosted: Mon Jul 04, 2005 2:01 pm     Reply with quote

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

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

PostPosted: Mon Jul 04, 2005 2:18 pm     Reply with quote

Nope, getc() should read it just fine. You might have a problem if you were using gets() though.
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