[an error occurred while processing this directive] [an error occurred while processing this directive]
Ответ:
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
[an error occurred while processing this directive] [an error occurred while processing this directive]

Отправлено AK 12 мая 2002 г. 04:18
В ответ на: : если кому нетрудно посмотри на кусочек ассемб. отправлено ah 11 мая 2002 г. 19:34

Извини, лень разбираться. Я лучше кину кусок своего кода, может, это поможет как-то


; ******************************************************************
; *** CCP2 service ***
; ********************
; 24-bit captured result is in CAP01H,CAP01M,CAP01L
; pulse is inverted

L_INT_CCP2
clrf TMOUT ; clear time-out
btfss FLAGS,CAP01 ; 0-to-1 capture?
goto L_INT_CAP10 ; no

; *************************************
; *** 0-to-1 capture (end of pulse) ***
; *************************************
; *** store CCPR2x
btfss PIR1,TMR1IF ; overflow?
goto L_01_CAP ; no
bcf PIR1,TMR1IF ; yes, clear int flag
incf T1CNTH ; increment counter extension

L_01_CAP
movf CCPR2H,W ; temp store
movwf CAP01M ;
movf CCPR2L,W ; temp store
movwf CAP01L ;

; *** re-init CCP2 ASAP (As Soon As Possible)
movlw CCP2CON_CAP10_ ; next edge - pulse start
movwf CCP2CON ; set mode
bcf PIR2,CCP2IF ; clear int flag

; *** capture T1CNT
L_INT_CAPT01
movf T1CNTH,W ; store T1CNT
movwf CAP01H ;

; *** finally
bcf FLAGS,CAP01 ; next edge is 1-to-0
goto L_INT_CHECK ; exit to interrupt switching routine

; **************************************
; *** 1-to-0 capture (pulse started) ***
; **************************************
L_INT_CAP10
btfss PIR1,TMR1IF ; TMR1 overflow?
goto L_10_CAP ; no
bcf PIR1,TMR1IF ; yes, clear int flag
incf T1CNTH ; increment MSB byte
L_10_CAP
movf CCPR2H,W ; temp store
movwf CAP10M ;
movf CCPR2L,W ; temp store
movwf CAP10L ;

; *** re-init CCP2 ASAP
movlw CCP2CON_CAP01_ ; next edge - end of pulse
movwf CCP2CON ; set mode
bcf PIR2,CCP2IF ; clear int flag

; *** capture T1CNT
movf T1CNTH,W ; store T1CNT
movwf CAP10H ;

; *** finally
bsf FLAGS,CAP01 ; next edge is 0-to-1
goto L_INT_CHECK ; exit

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru