I'm an idiot and I don't know why! - CCP1_INT


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Sep 2008
    Posts
    27

    Red face I'm an idiot and I don't know why! - CCP1_INT

    I've been learning about interrupts thanks to the fabulous work of Darrel. I've been able to get INT_INT, RX_INT, and RBC_INT working with no problems. But I can't figure out how to get CCP1_INT working. I've looked at others examples and still I am missing something. Will someone please show me how big of an idiot I really am?
    I've tried different configuration with TMR1...starting it, stopping it, leaving it out altogether with no luck.

    It doesn't get much easier than this....

    Code:
    '16f628A
    DEFINE OSC 20
    CMCON = 7
    VRCON = 0
    TRISB  = %00011011
    TRISA  = %00010000
    CCP1CON = %00000101 
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas" 
    
    clear
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   CCP1_INT,  _ToggleLED,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @ INT_ENABLE  CCP1_INT
    
    Mainloop:
            pause 1
            goto Mainloop
            
    ToggleLED:
        TOGGLE PORTA.0
    @ INT_RETURN

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    What is triggering the interrupt on RB3?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Sep 2008
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    pushbutton
    Attached Images Attached Images  

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    RB3 CCP1 input is an ST type, so it needs 0.8 * Vdd to meet the logic 1 input threshold.

    I can't really tell from your schematic, but it looks like you might have a voltage divider?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Sep 2008
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    5.00v on Pin3
    Attached Images Attached Images  

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hmm ... should work. I just tested it with the older version of DT_INTS-14 & ReEnterPBP.

    Are you using the latest version? I haven't tried the newer rev yet.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Sep 2008
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    I'm using version .93 Beta DT_INTS-14
    and version 3.2 ReEnterPBP.

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Using the same here, but tested it on real hardware with a pull-down holding RB3 low, and
    switch pulling it high when pressed. Works 100%.

    Is RB3 being held at ground until you press the switch?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  9. #9
    Join Date
    Sep 2008
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    Thanks Bruce for the feedback. I'll try to figure out "Whats Up With That"...
    Only wasted ~ 9 hours on it.....

  10. #10
    Join Date
    Sep 2008
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    Sorry Bruce, didn't see the last portion of your post. I assumed since it worked for you, it was a problem with the simulator. The simulator does show .02v when the button is not pressed and the rest of the inputs work correctly for the other interrupts. I guess I'm going to have to what for the real circuit board to arrive for further testing.

  11. #11
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I don't see anthing that would pull the inputs low when the switches aren't pushed.
    Charles Linquist

  12. #12
    Join Date
    Sep 2008
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    If I change the interrupt to either INT_INT or RBC_INT and move the input to another pin, it works fine. CCP1_INT does not work. It has to be the simulator. I don't have a real 16F628A to test yet. Should have the actual circuit board next week.
    Attached Images Attached Images  

Members who have read this thread : 1

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