|
|
View previous topic :: View next topic |
Author |
Message |
JP
Joined: 14 Feb 2004 Posts: 8 Location: Belgium
|
RS232 => RS232_ERRORS |
Posted: Wed Feb 18, 2004 2:21 am |
|
|
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
|
|
Posted: Wed Feb 18, 2004 6:53 am |
|
|
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
|
RS232_ERROR and getc() |
Posted: Wed Feb 18, 2004 8:16 am |
|
|
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 |
|
|
|
|
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
|