Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SENDREG EQU 0x20
- BITCOUNT EQU 0x21
- #define SDO PORTB,0
- #define SCK PORTB,1
- #define LAT PORTB,2
- SerOut movwf SENDREG ;load data to be sent into sendreg
- movlw 0x08 ;init bit counter
- movwf BITCOUNT
- bsf SDO ;default MSB=1
- btfss SENDREG,7 ;does MSB=1?
- bcf SDO ;no, send 0
- bsf SCK ;pulse clock
- bcf SCK
- rlf SENDREG,F ;shift bits
- decfsz BITCOUNT,F ;decrement bit counter
- goto $-7 ;continue sending until bit counter = 0
- bsf LAT ;all 8 bits sent, pulse latch
- bcf LAT ;all lines low
- bcf SCK
- bcf SDO
- return ;done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement