Searching \ for '[PIC]: Need help using capture inputs on 16F877' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=input
Search entire site for: 'Need help using capture inputs on 16F877'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Need help using capture inputs on 16F877'
2001\02\14@165941 by Fred Bailey

flavicon
face
I'm having trouble with the capture input CCP1. I have capture input CCP2
working (finally).
I have tested the Port C - I/O by disabling both capture modules and reading
port C.
All bits work OK (Hi and Low). But, I can't get CCP1 (RC2 input) to capture. I
have also tried
using CCP1 and CCP2 together and separately Only CCP2 works.

I initialize the CCP1 as follows:
Setup_capture  ; RC1input pulse, 50uSec wide every 16.6mSec, use capture2 (CCP2)
    BANK0
    movlw     0x3D
    movwf     T1CON          ; set up timer1 for internal clock,1:8
Prescale,timer Enabled
    BANK1
    bcf  PIE2, CCP2IE   ; dissable interrupt from capture
    BANK0
    clrf CCP1CON
    clrf CCP2CON   ; Clear prescaler, turn off CCP2 module
    movlw     0x05
    movwf     CCP2CON   ; set up Capture Mode on every rising edge
    BANK1
    bsf  PIE1,CCP2IE    ; enable interrupts from capture
    BANK0
    clrf CCPR2L    ; clear capture registers
    clrf CCPR2H

I run the program an the interrupt never occurs. The input voltage is 5.0 volts
when the pulse is high.
There is about 25usec rise and 25usec fall time.

I am using a Tech-tools Clearview Mathius emulator. I have tried replacing the
member module.

I can't find any code in the archives that uses capture.

Any help would be appreciated.

Best Regards, Fred Bailey (soon to be fired!)

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\02\14@202850 by Dan Michaels

flavicon
face
Fred Bailey wrote:
>I'm having trouble with the capture input CCP1. I have capture input CCP2
>working (finally).
>I have tested the Port C - I/O by disabling both capture modules and reading
>port C.
> All bits work OK (Hi and Low). But, I can't get CCP1 (RC2 input) to capture. I
>have also tried
>using CCP1 and CCP2 together and separately Only CCP2 works.
>
>I initialize the CCP1 as follows:
>Setup_capture  ; RC1input pulse, 50uSec wide every 16.6mSec, use capture2
(CCP2)
{Quote hidden}

Hi Fred, I have some suggestions here.

1 - I don't see you configuring the port direction bits.

2 - I don't see you doing a global interrupt enable, or resetting
   the relevant intr flag.

3 - I would not turn on Timer 1 until everything else was setup and ready
   to go. You do this in your first couple statements.

4 - Timer 1 is going to clock out very fast, probably < 1 sec, depending
   upon the xtal in use, so you have to get right on the job with your
   input signal soon as you run this code, else you will miss the event.

5 - You also have to jump thru a few hoops in order to avoid false captures,
   as detailed in the spec sheet.

6 - During development, I would first get this code working correctly
   in polled mode rather than interrupt mode - ie, simply poll the
   interrupt flag, and read the register. Fewer things to get confused
   about.

hope this helps,
- dan michaels
http://www.oricomtech.com
==================

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...