View previous topic :: View next topic |
Author |
Message |
ccarty
Joined: 20 Apr 2004 Posts: 2
|
!Help! RS232 OERR ERRORS |
Posted: Tue Apr 20, 2004 11:59 am |
|
|
I am using the #USE RS232 pre-processor directive as follows.
#use rs232(baud=9600,xmit=PIN_B2,rcv=PIN_B1,bits=8,parity=N,errors)
This is on a pic16f648A, using the hardware usart.
My question is:
When errors is added as an option, are both framing and overun errors cleared automatically?
I think that I have been able to create an OERR and it does not appear that it was cleared.
Thanks for your help. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
ccarty
Joined: 20 Apr 2004 Posts: 2
|
|
Posted: Tue Apr 20, 2004 1:16 pm |
|
|
PCM compiler version 3.184 ........the project compiles fine. I am questioning whether or not the OERR error is cleared automatically or if I need to check/clear it manually. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 20, 2004 1:34 pm |
|
|
I did a test compile with PCM vs. 3.184 for the 16F648A, and it
does generate code for the hardware USART. So that's OK.
Here is the generated code for the CCS library routine "getch".
It shows that they do check the OERR bit, and if it's set, they
clear it by toggling the CREN bit (per the data sheet).
Code: | 0004: BTFSS PIR1.5
0005: GOTO 004
0006: MOVF RCSTA,W
0007: MOVWF rs232_errors
0008: MOVF RCREG,W
0009: MOVWF @78
000A: BTFSS rs232_errors.1 // Test the OERR bit
000B: GOTO 00E
000C: BCF RCSTA.4 // If OERR = 1, then toggle CREN
000D: BSF RCSTA.4
000E: NOP
000F: BCF PCLATH.3
0010: GOTO 020 (RETURN) |
|
|
|
Guest
|
|
Posted: Tue Apr 20, 2004 1:41 pm |
|
|
thanks for your help... |
|
|
|