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

RS232 => RS232_ERRORS

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



Joined: 14 Feb 2004
Posts: 8
Location: Belgium

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

RS232 => RS232_ERRORS
PostPosted: Wed Feb 18, 2004 2:21 am     Reply with quote

Hello everybody,

Please excuse my bad english,

I want to use the hardware diagnostic option of the RS232 serial port for
a PIC16F877.
I have read that the RS232_ERRORS variable can help me to
solve this problem but the manual is no so clear about this function.
Have You a litle description of each bits that compose the variable
( or the variable is this a simple copy of a common register of the pic like RCSTA ) ?

My 2° question is the following :

The C language is very new for me, so can I use the Getc() function to read a byte ( 0 -> 255 thus not an ASCII character ) or may have to read
the incoming byte directly in the RCREG register of the PIC ?

To finish, I find that compilers CCS are really super but the
documentation should be sometimes more complete.

Thank You for your help,

J-P
Guest








PostPosted: Wed Feb 18, 2004 6:53 am     Reply with quote

This forum may be your best source for information on RS232_ERRORS. If you try a search using key words: RS232 ERRORS, you shoukld find quite a lot of info. I have used it in a decalration as follows:

#use rs232(baud=9600, xmit=PIN_A2,rcv=PIN_A3, ERRORS)

Using it like this should clear RS232 errors when they occur, but I haven't done anything in detail with it.

To answer your second question.

"The C language is very new for me, so can I use the Getc() function to read a byte ( 0 -> 255 thus not an ASCII character ) or may have to read......"

you can use getc() or getch(). The value is as you pointed out 0..255 (but this will give the ascii equivilent if you need it - just store it or display it as char or int as required.

Experiment with this to see the result.

char letter;
letter = 'A'
printf("ASCII: %c, int:%d", letter, letter);
JP



Joined: 14 Feb 2004
Posts: 8
Location: Belgium

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

RS232_ERROR and getc()
PostPosted: Wed Feb 18, 2004 8:16 am     Reply with quote

Hi,


Thank You for your response and the example.
I am happy to learn that I can read so easy a byte with the getc() function.

Have a nice day,

J-P
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