Searching \ for ' [PIC] 16F786 UART Receive Problem' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16F
Search entire site for: '16F786 UART Receive Problem'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] [PIC] 16F786 UART Receive Problem'
2001\09\01@182609 by Ian Jordan

flavicon
face
I have been using Tom McGahee's RS-232 code to get started on an RS-232
project. I've stripped the code down so that it's "receive only," which is
what I'll be needing.

The problem that I am having is that the MSB of the receive buffer seems to
invert if I type the same character twice. That is, I can type characters
all day long, but if I type "11111111," the MSB inverts each time I type
"1," after the second one is typed. This happens with any character sent,
including 0xFF, which obviously has the MSB set. Typing any character
in-between repeats prevents this problem, and I see no problems when typing
non-repeating characters.

I can't seem to find any reason for this, and my code needs to be able to
receive 0xFF twice in a row and tell it apart from 0xFF followed by 0xEF, so
I can't just ignore the MSB, as you could if you were just doing ASCII text.

Has anyone seen this behavior before and is there a way around it? Do I need
to clear some buffer or something? I tried cycling RCSTA,CREN between each
character and it still does it.

Thanks,
   Ian Jordan

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\09\03@193334 by Tony Nixon

flavicon
picon face
Ian Jordan wrote:
>
> I have been using Tom McGahee's RS-232 code to get started on an RS-232
> project. I've stripped the code down so that it's "receive only," which is
> what I'll be needing.

You can probably try this which should echo the same character back.

;
; ------------------------------------
; SET BAUD RATE TO COMMUNICATE WITH PC
; ------------------------------------
; Boot Baud Rate = 9600, No Parity, 1 Stop Bit
;
       bsf STATUS,RP0
       movlw d'25'             ; 9600 baud
       movwf SPBRG
       movlw b'00100100'               ; brgh = high (2)
       movwf TXSTA             ; enable Async Transmission, set brgh
       movlw b'10010000'               ; enable Async Reception
       clrf STATUS             ; RAM Page 0
       movwf RCSTA


Loop    call Receive
       movwf TXREG
       goto Loop

;
; ----------------------------------------
; RECEIVE CHARACTER FROM RS232 OR INTERNAL
; ----------------------------------------
; This routine does not return until a character is received.

Receive nop
         btfss PIR1,RCIF               ; check for received data
         goto Receive

         movf RCREG,W
         return


--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
spam_OUTsalesTakeThisOuTspambubblesoftonline.com

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...