Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Capture Mode problem - P16F877A

Status
Not open for further replies.

talhak

New Member
My another problem with P16F877A is "Capture Mode".. It doesn't capture the value of CCPR1L when I gave clock from RC2 pin.. I sent the value to display to see, but there's no change.. Please can anyone help me? Thanx a lot..

Here's my .asm program:

Code:
list p=16f877a;
#include <p16f877a.inc>
__CONFIG H'3FF0'

NUM EQU h'21'

ORG h'00'
GOTO START
ORG h'04'
GOTO INT

DELAY:
	BSF STATUS,2
	MOVLW h'60'
DECRE:
	DECF SAYAC,1
	BTFSC STATUS,2
	RETURN
	GOTO DECRE

INIT:
	BSF STATUS,5
	BSF TRISC,2 ;RC2 INPUT 
	BSF INTCON,7
	BSF INTCON,6
	BSF PIE1,2  ; CCP1IE ACTIVE
	BCF PIE1,0  ; TMR1 INT PASSIVE
	CLRF TRISB
		
	BCF STATUS,5
	;CLRF PORTB
	MOVLW h'00'
	MOVWF PORTB
	BCF PIR1,2  ; CCP1IF CLEARED
	MOVLW h'A0'
	MOVWF TMR1H
	MOVLW h'00'
	MOVWF TMR1L
	BCF CCP1CON,3
	BSF CCP1CON,2
	BCF CCP1CON,1
	BSF CCP1CON,0   ; EVERY RISING EDGE
	BSF T1CON,0 ; TMR1 ON
	RETURN

INT:
	BCF INTCON,7
	BCF INTCON,6
	BSF STATUS,5
	BCF PIE1,2
	
	BCF STATUS,5
	BCF PIR1,2 ; CCP1IF
	MOVF CCPR1L,0
	MOVWF PORTB ; TMR1L ICERIGI -> PORTB'DEKI LEDLERE
	CALL DELAY
	;INCF PORTB,0
	MOVLW h'A0'
	MOVWF TMR1H
	MOVLW h'00'
	MOVWF TMR1L
	BSF STATUS,5
	BSF PIE1,2
	BCF STATUS,5
	BSF T1CON,0 ; TMR1 ON
	BSF INTCON,7
	BSF INTCON,6
	RETFIE

START:
	CALL INIT
LOOP:GOTO LOOP
	END

And here's my design:

**broken link removed**
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top