Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    sougata,

    I'm glad it's working out for you. And yes, it is more managable. Kinda the whole idea behind it.

    Squibcakes,

    No, it doesn't work that way.

    The AD_INT is fired on the completion of an A/D conversion. Not when the value changes.

    So, in your AD_INT handler, you could test to see if the recent A/D reading differs from the previous A/D value. If it does, call a subroutine.

    Then start another conversion before exiting the handler.

    Added: Or like sougata said, have a timer periodicaly start a conversion, then do the same.

    HTH,
    DT

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Quote Originally Posted by Darrel Taylor View Post
    sougata,

    I'm glad it's working out for you. And yes, it is more managable. Kinda the whole idea behind it.

    Squibcakes,

    No, it doesn't work that way.

    The AD_INT is fired on the completion of an A/D conversion. Not when the value changes.

    So, in your AD_INT handler, you could test to see if the recent A/D reading differs from the previous A/D value. If it does, call a subroutine.

    Then start another conversion before exiting the handler.

    Added: Or like sougata said, have a timer periodicaly start a conversion, then do the same.

    HTH,
    I've been using DT_INTS-14 for a while with various types of interrupts but now I want to implement one for A/D. I've created the dummy interrupt handler, but my question is whether I can read the value of the conversion using PBP's ADCIN or should I grab directly from the registers. If the latter, I could use some help with that.

    My ADC set up is as follows:

    Code:
    ; PIC12F1840
    
    DEFINE ADC_BITS      8       ; Set number of bits in result
    DEFINE ADC_SAMPLEUS  5       ; Set sampling time in uS
    DEFINE ADC_CLOCK     3       ; Set clock source (3=rc)
    
    FVRCON    = 0                ' Fixed Voltage Reference is disabled
    ANSELA    = %00000010        ; Analog on PORTA.1 (AN1) only
    ADCON0    = %00000101        ' ADC (analog-to-digital) is enabled on AN1 (RA1) only
    ADCON1.7  = 0                ; Left-justified results in 8-bits
    
    ASM
    INT_LIST  macro    ; IntSource,           Label,  Type, ResetFlag?
            INT_Handler    INT_INT, _Flash_Mode_Btn,   PBP,  yes
            INT_Handler     AD_INT, _ADC_change,       PBP,  yes
        endm
        INT_CREATE     ; Creates the interrupt processor
    ENDASM
    
    
    ' Enable interrupts
    @ INT_ENABLE   INT_INT      ; INT Interrupt
    @ INT_ENABLE   AD_INT       ; A/D Interrupt
    I'm working on implementing Darrel's MIBAM with a trim pot to set the brightness of an LED.

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 8

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