Electrix
Member
I tried this on my simulator, but the TRMT(TXSTA,1) is just no turning low. Hence my Transmit Shift Register is not getting filled up and no data is being sent out.
PIC 16F73
4Mhz.
list p=16f73 ;list directive to define processor
#include <p16f73.inc> ;processor specific definitions
errorlevel -302 ;suppress "not in bank 0" message
__CONFIG _CP_OFF
;Variables decleration
DataByte equ 0x21
;This code executes when a reset occurs.
ORG 0x000 ;place code at reset vector
ResetCode: clrf PCLATH ;select program memory page 0
goto Main ;go to beginning of program
Main
;Loading DataByte
movlw 0x10
movwf DataByte
BANKSEL SPBRG
movlw D'25'
movwf SPBRG
BANKSEL TXSTA
bsf TXSTA,BRGH
BANKSEL SPBRG
movlw D'25'
movwf SPBRG
BANKSEL TXSTA
bsf TXSTA,BRGH
BANKSEL TXSTA
movlw B'00100100'
movwf TXSTA
BANKSEL RCSTA
movlw B'10010000'
movwf RCSTA
BANKSEL TXSTA
movlw B'00100100'
movwf TXSTA
BANKSEL RCSTA
movlw B'10010000'
movwf RCSTA
BANKSEL PIR1
WaitTX: btfss PIR1,TXIF
goto WaitTX
BANKSEL PIR1
BANKSEL DataByte
movf DataByte,W
BANKSEL TXREG
movwf TXREG
end
PIC 16F73
4Mhz.
list p=16f73 ;list directive to define processor
#include <p16f73.inc> ;processor specific definitions
errorlevel -302 ;suppress "not in bank 0" message
__CONFIG _CP_OFF
;Variables decleration
DataByte equ 0x21
;This code executes when a reset occurs.
ORG 0x000 ;place code at reset vector
ResetCode: clrf PCLATH ;select program memory page 0
goto Main ;go to beginning of program
Main
;Loading DataByte
movlw 0x10
movwf DataByte
BANKSEL SPBRG
movlw D'25'
movwf SPBRG
BANKSEL TXSTA
bsf TXSTA,BRGH
BANKSEL SPBRG
movlw D'25'
movwf SPBRG
BANKSEL TXSTA
bsf TXSTA,BRGH
BANKSEL TXSTA
movlw B'00100100'
movwf TXSTA
BANKSEL RCSTA
movlw B'10010000'
movwf RCSTA
BANKSEL TXSTA
movlw B'00100100'
movwf TXSTA
BANKSEL RCSTA
movlw B'10010000'
movwf RCSTA
BANKSEL PIR1
WaitTX: btfss PIR1,TXIF
goto WaitTX
BANKSEL PIR1
BANKSEL DataByte
movf DataByte,W
BANKSEL TXREG
movwf TXREG
end