HC595 MACRO Var,Var1
Local Loop ; Local Label
MOVLW .8 ; Transfer 8 bits
MOVWF Var1 ; Initializing counter
Loop
RLF Var,f ; Rotate "Var" one place to the left
BTFSS STATUS,C ; Is carry 1?
BCF Bits ; If not set data line to 0
BTFSC STATUS,C ; Is carry 0?
BSF Bits ; If not set data line to 1
BSF Clock ; Generate one clock
BCF Clock ;
DECFSZ Var1,f ; Has 8 bits been sent?
GOTO Loop ; If not, repeat
BSF Latch ; If all 8 bits have been sent, set latch
BCF Latch
ENDM