Searching \ for 'CCP1 in capture mode: Question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/index.htm?key=question
Search entire site for: 'CCP1 in capture mode: Question'.

Truncated match.
PICList Thread
'CCP1 in capture mode: Question'
1997\09\10@051845 by Jim Main

flavicon
picon face
I'd like to use one of the CCP modules on the 16C74A to decode a frame
of pwm data (not unlike R/C equipment, but with 16 pwm pulses in the
frame)

To capture the mark/space ratio, I need to capture on the leading and
the trailing edge of each pulse.

I thought of changing the CCPCON register as soon as the first positive
edge had caused an interrupt, so that it'd capture again on the trailing
edge.

The data book says that doing this can cause an unwanted interrupt - is
it enough to clear out the CCP1IF bit again before returning from the
first interrupt?

Jim
--
Jim Main

1997\09\10@052525 by fastfwd

face
flavicon
face
Jim Main <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> I'd like to use one of the CCP modules on the 16C74A to decode a
> frame of pwm data
> ....
> I need to capture on the leading and the trailing edge of each
> pulse.
>
> I thought of changing the CCPCON register as soon as the first
> positive edge had caused an interrupt, so that it'd capture again on
> the trailing edge.
>
> The data book says that doing this can cause an unwanted interrupt -
> is it enough to clear out the CCP1IF bit again before returning from
> the first interrupt?

   Yes.

   -Andy

=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

=== For PICLIST help (including "unsubscribe" instructions),
=== put the single word "help" in the body of a message and
=== send it to: listservspamKILLspammitvma.mit.edu

1997\09\10@080109 by Andy Kunz

flavicon
face
At 09:37 AM 9/10/97 +0100, you wrote:
>I'd like to use one of the CCP modules on the 16C74A to decode a frame
>of pwm data (not unlike R/C equipment, but with 16 pwm pulses in the
>frame)
>
>To capture the mark/space ratio, I need to capture on the leading and
>the trailing edge of each pulse.
>
>I thought of changing the CCPCON register as soon as the first positive
>edge had caused an interrupt, so that it'd capture again on the trailing
>edge.
>
>The data book says that doing this can cause an unwanted interrupt - is
>it enough to clear out the CCP1IF bit again before returning from the
>first interrupt?

Andy Warren's "yes" is correct.

I do it this way myself in my robotic controller (which, btw, does 16
channels in/out too, at 1uS resolution on 4 MHz).

Basic flow:

in the ISR:

       if CCP1IF
               record captured width
               set CCP1 to other edge
               CCP1IF = 0


To save time later, I test to see if the measured edge was the rising or
falling edge.  If rising edge, I clear TMR1 before continuing so that I end
up with a 0~2500uS value in my array of widths, and on falling edges just
make sure the high period was valid.  I process (validate, modify, etc) the
array of widths in the foreground.

Andy

==================================================================
Andy Kunz - Montana Design - 409 S 6th St - Phillipsburg, NJ 08865
         Hardware & Software for Industry & R/C Hobbies
       "Go fast, turn right, and keep the wet side down!"
==================================================================

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