;Передача данных по SPI.В схеме для наглядности используется внешний сдвиговый регистр.            
            LIST        P=16F628A
            INCLUDE     P16F628A.INC
            __CONFIG    _INTOSC_OSC_NOCLKOUT&_WDT_OFF&_PWRTE_ON&_MCLRE_OFF&_LVP_OFF
            ERRORLEVEL  -302
            CBLOCK      20H
            J:1,K:1,TMP:1
            ENDC
BANK0       MACRO
            BCF         STATUS,RP0
            BCF         STATUS,RP1
            ENDM
BANK1       MACRO
            BSF         STATUS,RP0
            BCF         STATUS,RP1
            ENDM
            ORG         0
            GOTO        START
START       MOVLW       7
            MOVWF       CMCON
            CLRF        PORTB
            BANK1
            MOVLW       B'00000110'   ;RB1/DT(даные) и RB2/CK(импульс) как вход
            MOVWF       TRISB         
            MOVLW       B'11110011'   ;Master mode,Selects 9-bit transmission,Transmit enabled,
            MOVWF       TXSTA         ;Synchronous mode,
            MOVLW       .103          ;Baud Rate = 9600
            MOVWF       SPBRG         
            BANK0
            MOVLW       B'10000000'   ;Serial port enabled
            MOVWF       RCSTA
MAIN        MOVLW       1
            MOVWF       TMP
TLOOP       MOVFW       TMP
            MOVWF       TXREG         ;Передаем данные
            CALL        DELAY
            BCF         STATUS,C
            RLF         TMP,F
            BTFSS       STATUS,C
            GOTO        TLOOP
            GOTO        MAIN
            
DELAY       MOVLW       .255
            MOVWF       J
JLOOP       MOVLW       .255
            MOVWF       K
KLOOP       DECFSZ      K,F
            GOTO        KLOOP
            DECFSZ      J,F
            GOTO        JLOOP
            RETURN
            END