Mike Harrison wrote:
{Quote hidden}>
>
> a slightly smaller version...
>
> movlw 1 ; end of byte marker
> movwf byte_in
> loop
> bsf clk
> goto $+1 ; 2-cycle NOP (if needed)
> clc
> btfsc data_pin
> sec
> bcf clk ; clear clk as soon as data has been read
> ; to allow maximum time for clk fall
> rlf byte_in
> skpc ; loop until marker bit falls out end of byte
> goto loop
>
> if you can arrange for data_in to be bit 0 or 7 of a port, you can
> read it into carry using rrf port,w or rlf port,w respectively.
and an even slightly smaller version
movlw 1
movwf byte_in
clrc
loop
bsf clk
goto $+1 ;probably mot necessary
rlf byte_in,F
btfsc data_pin
bsf byte_in,0
bcf clk
skpc
goto loop
Scott