CCp module question.


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2005
    Posts
    23

    Default CCp module question.

    I'm learning CCp module.

    There is something I don't understand yet.
    I want to know the length of the first 16 rising edges of an incoming stream to decide whether it's the right stream or noise..

    I have to check when a single rising edge has come (CCP1CON % 00000101), then switch to CCP1CON %00000111( 16th edge capture), Timer1 starts, then finally when another event occured read the CCPR1 bytes and decide if this is the correct timing.

    Is this the correct procedure?

    It seems to me that this way i need 17 rising edges (the first for let Timer1 start and the other 16 for having the correct event on CCP module).Where i'm wrong....


    Thanks .
    Roberto

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I think it would be better to leave it on "Every Rising Edge". Start the timer on the first edge, count 15 more interrupts, then stop the timer.

    Of course, for that you can use an external interrupt (without the CCP) to do the same thing.
    <br>
    DT

  3. #3
    Join Date
    Apr 2005
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Thanks for your prompt reply.

    I read somewhere that CCP module is less intrusive than "normal "interrupt loops.
    If i could read 16 high edges i'll get just one interrupt and my job would be done. I'm already using Usart,I2c,PORTB, PORTB0,tmro, tmr2 interrupts and when polling for incoming data sometimes i'm loosing an interrupt.

    Roberto

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    That's true, it can be "Less Intrusive", under certain conditions.

    But like you said, you would need 17 low-high transitions to get the reading you're looking for. If that works for you then CCP is a good way to go. But if it has to be 16, then there's no way to start the timer at the right time.

    I hope you're using ASM interrupts, cause all that stuff will never work with ON INTERRUPT.
    <br>
    DT

Similar Threads

  1. Version Control
    By btaylor in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 16th October 2011, 17:12
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. CCP question
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th December 2005, 17:08
  4. Timer / CCP Question
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd November 2005, 08:22
  5. CCP Module How to ?
    By capitano in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th February 2005, 08:08

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts