Wond3rboy
Member
Serial PIC[ler]
Hi i was just checking out the UART tool of the Pickit2 and got it to work perfectly once but now am not getting correct data
Here are a few questions that i want to ask:
As SPBRG register contains a value that does not give you the exact Baudrate what effect does this have on the actual transmission?
Also what happens because of the BR error?
Take the example of the code given below:
The oscilator is the internal oscillator 4MHz and the SPBRG value for 4800(since it gives the least error) is 12.
The error calculated is .15% so how does it end up as...every 10000 characters will have 15 corrupted characters?
I mean what the error implies?
Thanks.
Hi i was just checking out the UART tool of the Pickit2 and got it to work perfectly once but now am not getting correct data
Here are a few questions that i want to ask:
As SPBRG register contains a value that does not give you the exact Baudrate what effect does this have on the actual transmission?
Also what happens because of the BR error?
Take the example of the code given below:
Code:
LIST P=18F1320
INCLUDE <P18F1320.INC>
CONFIG OSC=INTIO2,WDT=OFF,LVP=OFF
Org 0
movlw 7F
MOVWF ADCON1
MOVLW B'01100000'
MOVWF OSCCON
CLRF TRISB,TX
CLRF TRISB,RX
MOVLW D'12'
MOVWF SPBRG
MOVLW B'00100000'
MOVWF TXSTA
BSF RCSTA,SPEN
START:
MOVLW HIGH(D)
MOVWF TBLPTRH
MOVLW LOW(D)
MOVWF TBLPTRL
REPEAT:
TBLRD*+
MOVF TABLAT,W
BZ START
MOVWF TXREG
AGAIN:
BTFSS PIR1,TXIF
BRA AGAIN
BRA REPEAT
D:
DB "SYED",0
END
The oscilator is the internal oscillator 4MHz and the SPBRG value for 4800(since it gives the least error) is 12.
The error calculated is .15% so how does it end up as...every 10000 characters will have 15 corrupted characters?
I mean what the error implies?
Thanks.
Last edited: