DT CMP Interrupt Problem


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    I don't have 16F877A now. If I continue to use 16F877, what is the best method to detect IN1>IN2?

    This means I don't have any interrupt, and I have to poll the go/done bit in ADCON0 while sacrificing on executing other task?

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


    Did you find this post helpful? Yes | No

    Default

    The A/D module has an interrupt that fires when a conversion is complete.

    You don't have to sit in a loop polling the Go/Done bit.
    <br>
    DT

  3. #3
    Join Date
    Aug 2008
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Oh, that's great. How do I implement this using DT interrupt?
    Below is what I'm currently doing, using pause 25ms before the next AD.

    Code:
    define OSC 20      
    
    ' Define ADCIN parameters
    Define  ADC_BITS        10     	' Set number of bits in result
    Define  ADC_CLOCK       3     	' Set clock source (3=rc)
    Define  ADC_SAMPLEUS    50    	' Set sampling time in uS
    
    
    ADCON1= %00000111      'PIC16F877 all analog input except RE1,RE2
    
     'start AD here 
            ADCIN 0, adval				' Read channel0 RA.0 to adval
            pause 25
            ADCIN 1, adval2				' Read channel1 RA.1 to adval
            pause 25

Similar Threads

  1. Problem with Interrupt on PIC18F4620 PORTB
    By rookie in forum Off Topic
    Replies: 1
    Last Post: - 22nd March 2007, 01:34
  2. Replies: 1
    Last Post: - 2nd November 2006, 23:24
  3. Interrupt Problem
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th November 2005, 20:58
  4. Interrupt stack overflow problem with Resume {label}
    By Yuantu Huang in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd May 2005, 01:17
  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 : 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