16F676 Interupt


Closed Thread
Results 1 to 3 of 3

Thread: 16F676 Interupt

  1. #1
    Join Date
    Oct 2004
    Location
    Fayetteville Arkansas
    Posts
    44

    Default 16F676 Interupt

    I'm switching from a 12F629 to a 16F676 to get more pins and trying to work out the differences in the pics. The following is supposed to use a falling edge Port Change Interupt on Pin 2. The program Blinks an LED at power up and is supposed to blink it 5 times at interupt. It blinks at power up but does not interupt. I had all of it worked out for the 629 and am sure there is something small I'm missing, but I can't seem to find it. Any help would be appriciated.

    @ DEVICE PIC16F676,INTRC_OSC_NOCLKOUT,WDT_ON,PWRT_OFF,BOD_O FF,PROTECT_OFF,CPD_OFF,MCLR_OFF
    ANSEL = 0 ' DISABLE THE ANALOG INPUT
    CMCON = 7 ' DISABLE COMPARATOR ON PORTA
    VRCON = 0 ' A/D Voltage reference disabled
    TRISA = %00111110
    WPUA = %00110110
    SYMBOL TRIG = PORTA.5
    SYMBOL LED = PORTA.0
    I VAR WORD
    INTCON = %10000000
    IOCA = %00100000
    OPTION_REG = %00001000
    OUTPUT PORTA.0
    LOW LED
    PAUSE 1000
    HIGH LED
    GOTO BASE
    MYINT:
    INTCON = %10000000
    ILOOP:
    I = I + 1
    IF I = 5 THEN
    GOTO BASE
    ENDIF
    GOTO ILOOP
    LOW LED
    PAUSE 1000
    IF TRIG = 0 THEN
    ENDIF
    GOTO ILOOP
    BASE:
    I = 0
    ON INTERRUPT GOTO MYINT:
    INTCON = %10001000
    LOOP:
    SLEEP 240
    GOTO LOOP

  2. #2
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Hi Butch,
    Check out this bit...

    ILOOP:
    I = I + 1
    IF I = 5 THEN
    GOTO BASE
    ENDIF
    GOTO ILOOP


    When interrupted, that will just increment 'I', jump back to 'ILOOP, then go back to 'BASE' when 'I'=5, never blinking the LED.

    BTW - the 'MYINT' should terminate with a 'RESUME' - don't know what will happen the way it is in your code.

    Arch

  3. #3
    Join Date
    Oct 2004
    Location
    Fayetteville Arkansas
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Thank you Arch. I looked at that so many times its nuts and never saw it. Figured another set of eyes would pick something up easily. Works like a charm now!

Similar Threads

  1. Replies: 4
    Last Post: - 17th December 2009, 00:29
  2. Help! My 'interupt', erhm ...only interupts the one time?!!!
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd November 2009, 12:49
  3. on interupt with pic 16F619
    By cpayne in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th March 2008, 17:39
  4. 16F676 Interupt on Change pin determination
    By BGreen in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 5th May 2006, 17:04
  5. interupt & Sleep Problem - HELP!!
    By Santana in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd November 2004, 10:39

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