12F675 - How to configure the INTCON command to activate the various interrupts?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    I will carefully read your .txt files.
    not sure if I have to point out the obvious but
    what sort of file would "ZORB.pbp.txt" if you took the ".txt" off the end ?
    [the pbp forum will not allow a pbp file to be uploaded , you need to mask its type with a .txt extension]


    But I really only master Basic... not really ASM
    such a limited outlook

    good luck employing interrupts in any other way with such limited chips as 12f675
    Warning I'm not a teacher

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    " not sure if I have to point out the obvious" but you often have some degrading, demeaning cutting comment to people seeking help. Basically a reflection of yourself......

    please delete this

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    I will carefully read your .txt files.
    i read that as either a lack of understanding on how files are uploaded onto the forum or
    a intimation that i have uploaded something weird, unusual or incorrect. i don't know which
    but either way since it was specifically pointed out an explanation was warranted


    not sure if I have to point out the obvious but...
    makes it clearer why the txt extension is there and how to deal with it, just in case an explanation was
    necessary




    but you often have some degrading, demeaning cutting comment to people seeking help. Basically a reflection of yourself......
    really
    Warning I'm not a teacher

  4. #4
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    To activate a single I/O pin as IOC (Interrupt on Change) you use the "IOC" Register; Register 3.4 in the Data Sheet:
    Code:
    IOC.0 = 1  'Enables IOC on GPIO 0
    If you want to enable IOC interrupts on multiple GPIO pins you can use the IOC Register in binary mode. Assume you want an IOC Interrupt on GPIO pins 0 & 1:
    Code:
    IOC = 000011  'Enables IOC on GPIO 0 & 1
    Then you must enable IOC interrupts using the INTCON Register:
    Code:
    INTCON.3 = 1  'Enables IOC Interrupts
    Next, you need to create an Interrupt Handler (See PBP Manual) so when you get the Interrupt, you can do something with it. In your Interrupt Handler, when you get an IOC interrupt you have to clear the Interrupt Flag:
    Code:
    INTCON.0 = 0  'Clears IOC Interrupt Flag
    If you need more than one GPIO IOC Interrupt (2 or more Port Pins), you will have to Poll which GPIO triggered the IOC Interrupt:
    Code:
    IF GPIO.0 = 1 THEN
      <Interrupt Handler Code for GPIO.0>
    ELSE IF GPIO.1 = 1 THEN
      <Interrupt Handler Code for GPIO.1>
    ENDIF
    The above code assumes that a low-to-high transition triggers your IOC interrupt. You may need to change that depending on your goals.

    <edit> I tried to write "IOC = 000011 'Enables IOC on GPIO 0 & 1" but the forum keeps changing it to "IOC = 000011 'Enables IOC on GPIO 0 & 1"
    Last edited by mpgmike; - 26th April 2023 at 00:51.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    Next, you need to create an Interrupt Handler (See PBP Manual) so when you get the Interrupt, you can do something with it. In your Interrupt Handler, when you get an IOC interrupt you have to clear the Interrupt Flag:
    not forgetting :-


    A mismatch condition will continue to set flag bit GPIF.
    Reading GPIO will end the mismatch condition and
    allow flag bit GPIF to be cleared.
    Warning I'm not a teacher

Similar Threads

  1. Basic problem with interrupts and sleep command
    By Davidmarks in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 21st February 2012, 01:21
  2. CONFIGURE & OSCCON & meProg configure
    By SUNFLOWER in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th February 2011, 21:25
  3. How to activate ccp3 on portB.5 of 16f777 ?
    By abdullahsavas in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2010, 08:17
  4. EEPROM Write command with interrupts??
    By Elnino in forum General
    Replies: 4
    Last Post: - 23rd November 2009, 06:44
  5. intcon?
    By jonas2 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd September 2009, 11:07

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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