2011-12-28, 02:59:30
Thanks. In the code you have both DEN=1 and TXEN=1 what are those?
Running at 1MHz each instruction takes 4us to execute. There are three NOPs in the firmware after the tx enable pin is set high, that equals 12us which should be enough according to your code. You could however insert one or more NOPs just to rule that out.
Also insert a NOP or two after the byte has been sent. See below.
If possible, try a lower baud rate and/or higher frequency.
In ds30loader.asm
Running at 1MHz each instruction takes 4us to execute. There are three NOPs in the firmware after the tx enable pin is set high, that equals 12us which should be enough according to your code. You could however insert one or more NOPs just to rule that out.
Also insert a NOP or two after the byte has been sent. See below.
If possible, try a lower baud rate and/or higher frequency.
In ds30loader.asm
Code:
;------------------------------------------------------------------------------
; Send()
;------------------------------------------------------------------------------
Send ; Enable tx
ifdef USE_TXENABLE
banksel PORTR_TXE
bsf PORTR_TXE, PORTB_TXE
nop ;needed?
nop
nop
-----------insert 1 more NOP here-------------------
endif
;Send byte
banksel TXREG_
movwf TXREG_ ;bank 0/3
; Wait for transmit shift register to get empty
banksel TXSTA_
txwait btfss TXSTA_, TRMT ;bank 1/3
goto txwait
; Disable tx
ifdef USE_TXENABLE
-----------insert 1-3 NOPs here-------------------
banksel PORTR_TXE
bcf PORTR_TXE, PORTB_TXE ;bank ?
endif
; Send complete
return