I have finished the code for PIC16F887 using assembly language. However, when I send it to the uc, it does not work. I checked again and again, but I don't know where I am wrong. Hope somebody can help me figure out where I am wrong. Thank you very much for helping
My goal in this code is just send the data in the table to IC74HC595.
PIN 0 of PORT E is CLK
PIN 1 of PORT E is Latch
PIN 2 of PORT E is data.
That's all
Here my code:
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
LIST P=16F887
INCLUDE P16F887.INC
__CONFIG _CONFIG1, _LVP_OFF & _FCMEN_ON & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _HS_OSC
__CONFIG _CONFIG2, _WRT_OFF & _BOR21V
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CBLOCK 0x20
DELAYH
DELAYM
DELAYL
sended_data
pointer
check_8_bits
ENDC
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ORG 0x00
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAIN
BANKSEL TRISE
MOVLW 0x00
MOVWF TRISE
MOVWF pointer
BANKSEL PORTE
MOVWF PORTE
read_again
MOVF pointer,0
CALL data_table
MOVWF sended_data
CALL send_595
MOVLW 0xFF
XORWF sended_data,0
BTFSC STATUS,Z
GOTO overflow
INCF pointer,1
CALL DELAY
GOTO read_again
overflow
MOVLW 0x00
MOVWF pointer
BCF STATUS,Z
CALL DELAY
GOTO read_again
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
send_595
BANKSEL PORTE
MOVLW 0x00
MOVWF check_8_bits
check_again
BTFSS sended_data,0
GOTO zero
GOTO one
zero
BCF PORTE,2
NOP
NOP
BSF PORTE,0
NOP
NOP
BCF PORTE,0
NOP
NOP
GOTO exit_595
one
BSF PORTE,2
NOP
NOP
BSF PORTE,0
NOP
NOP
BCF PORTE,0
NOP
NOP
exit_595
RRF sended_data,1
INCF check_8_bits
MOVLW d'8'
XORWF check_8_bits,0
BTFSS STATUS,Z
GOTO check_again
BCF STATUS,Z
BSF PORTE,1
BCF PORTE,1
RETURN
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
data_table
ADDWF PCL,1
RETLW b'00000000'
RETLW b'11111111'
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
DELAY
CLRF DELAYL
CLRF DELAYM
MOVLW h'2'
MOVWF DELAYH
WAIT
DECFSZ DELAYL
GOTO WAIT
DECFSZ DELAYM
GOTO WAIT
DECFSZ DELAYH
GOTO WAIT
RETURN
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
END