A Simple IOC Routine (Interrupt On Change)


Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Feb 2010
    Posts
    15

    Talking A Simple IOC Routine (Interrupt On Change)

    Hi,

    here is a simple Interrupt On Change program, that turns on a led on portC for pic16f684, it cost me a week to find this answer, I only hope that this help to solve problems easier for others...

    [code]'configuración

    ANSEL = 0 'I/O digitals
    OPTION_REG = 7 'Enable pullups
    IOCA.0 = 1 'Enable Interrupt on Change for RA0
    WPUA.0 = 1 'Enable pull up RA0
    TRISC = 0 'portC output
    TRISA = 7 'portA <2:0> input <5:3> output

    INTCON.0 = 0 'clear IOC flag
    INTCON.3 = 1 'Enable IOC interrupt
    INTCON.7 = 1 'Enagle GIE
    'variables
    I var byte 'missmatch variable for IOC
    inicio:
    if INTCON.0 = 1 THEN 'Change on portA ocurred?
    PORTC.5 = 1 'turn On led
    pause 500 'wait half second
    PORTC.5 = 0 'turn On led
    I = PORTA 'end missmatch
    INTCON.0 = 0 'clear IOC flag for next interrupt
    ELSE 'if no change is ocurred
    PORTC.5 = 0 'led continues off
    ENDIF '

    GOTO inicio 'loop[\code]

    PS. Sorry for my English. I can't make my code seccion work

    Regards,
    Luis Lugo
    Last edited by lugo.p; - 8th March 2010 at 16:28. Reason: Corrections

Similar Threads

  1. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  2. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  3. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  4. Simple Interrupt Program
    By eoasap in forum General
    Replies: 5
    Last Post: - 28th October 2005, 16:22
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01: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