Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ds30Loader with pic18F87J50 on UART2 [solved]
#2
it seems i solved the problem,
inspired my post "USART2 Problem - Solved" by joeausro, in functions
;------------------------------------------------------------------------------
; Send()
;------------------------------------------------------------------------------
Send ; Enable tx
ifdef USE_TXENABLE
bsf LATR_TXE, LATB_TXE
nop ;needed?
nop
nop
endif
;Send byte
movwf TXREG
; Wait for transmit shift register to get empty
txwait btfss TXSTA, TRMT
bra txwait
; Disable tx
ifdef USE_TXENABLE
bcf LATR_TXE, LATB_TXE
endif
; Send complete
return


;------------------------------------------------------------------------------
; Receive()
;------------------------------------------------------------------------------
Receive movlw BLDELAY
RcvIni movwf cnt1 ;
rpt2 movlw BL10MS ;
movwf cnt2 ;
rpt3 clrf cnt3
rptc clrwdt
btfss PIRRCIF_, RCIF_ ;test RX
bra notrcv
movf RCREG, w ;return read data in W
addwf crc, f ;compute crc
return
notrcv decfsz cnt3
bra rptc
decfsz cnt2
bra rpt3
decfsz cnt1
bra rpt2
; Receive timed out if we get here
bra exit
;------------------------------------------------------------------------------
i replaced
TXREG with UTXREG -- line 554
TXSTA with UTXSTA -- line 556
RCREG with URCREG -- line 577

now it works with UART2
Reply


Messages In This Thread
RE: ds30Loader with pic18F87J50 on UART2 - by dts - 2011-05-19, 12:06:07

Forum Jump:


Users browsing this thread: 1 Guest(s)