org 0x0004
movwf W_Temp
swapf STATUS,W
movwf S_Temp
clrf STATUS
btfss PIR1,RCIF ;is it a reception?
goto Exit
bcf PIR1,RCIF
CHR_A movf RCREG,W ;check charactor "A"
movwf T_Rcreg ;move to temperory registor
xorlw 'A'
btfss STATUS,Z
goto CHR_B
btfss Enable,0
goto $+3
bsf Enable,1
goto Exit
clrf IMAGE
clrf PORTA
clrf Enable
call Clear_CHR
goto Exit
CHR_B movf T_Rcreg,W ;check charactor "B"
xorlw 'B'
btfss STATUS,Z
goto CHR_Number
btfss IMAGE,0
goto Exit
movlw b'10'
xorwf IMAGE,F
movf IMAGE,W
movwf PORTA
goto Exit
Read_CHR btfss PIR1,RCIF ;is it a reception?
goto Read_CHR
bcf PIR1,RCIF
movf RCREG,W ;yes,then take a copy of the character
return
Exit movf RCREG,W
movf RCREG,W
movf RCREG,W
swapf S_Temp,W
movwf STATUS
swapf W_Temp,F
swapf W_Temp,W
retfie