Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define SDO PORTA,0
- #define SCK PORTA,1
- #define CS PORTA,2
- SEND EQU 0x20
- SPISend bcf CS ;chip select lo
- movlw 0x08 ;initialize bit counter
- movwf BITCOUNT
- btfss SEND,7 ;is MSB in send register high?
- goto SendLow ;no, send 0
- SendHigh bsf SDO ;send 1
- goto Shift
- SendLow bcf SDO ;send 0
- goto Shift
- Shift bsf SCK ;pulse clock
- bcf SCK
- rlf SEND,F ;shift bits to the left
- decfsz BITCOUNT,F ;decrement bit counter
- goto $-10 ;loop back if bit counter > 0
- bsf CS ;bit counter = 0, chip select hi
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement