Page 206 - Embedded Microprocessor Systems Real World Design
P. 206
, --
; 1: -I \-I \-
-
1
; 0: -1 \
7
; This makes the data self-clocking.
; Interrupts are momentarily enabled between bits
; to minimize latency time.
diagnostic:
movlw 8 ; bit count, LS byte
movwf txbits ; store at bit counter
; Transmit LS byte first
diaglsblp:
bcf intcon, gie ; disable interrupt during bit
; output time.
bsf portb, 7
rrf diaglsb,f ; rotate DIAQLSB.0 into cy
bcf portb, 7 ; clock bit falling edge
btfsc status,c ; check carry
bsf portb,? ; set data clock if bit = 1
noP
bcf portb, 7 ; clear data clock, set or not.
bsf intcon, $le ; enable interrupts again
decf sz txbits , f ; done?
goto diaglsblp
movlw 8 ; bit count, MS byte
movwf txbits ; store at bit counter
;Transmit MS byte
diagmsblp:
bcf intcon, gie ; clear interrupt during bit
; output time.
bsf portb, 7 ; clock bit rising edge
rrf diagmsb,f ; rotate DIAGMSB.0 into cy
bcf portb, 7 ; clock bit falling edge
btfsc status$ ; check carry
bsf portb, 7 ; set data clock if bit = 1
nOP
Adding Debug Hardware and Software 187