Need help on ADC : Software R/C filter


Results 1 to 4 of 4

Threaded View

  1. #3
    Join Date
    May 2007
    Location
    Area 71
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Hi Ioannis,
    My application is simple, it just read the potentiometer / analog pins and then output the pulse accordingly.
    Usually I put a hardware RC filter between the pots and the pins. It serves as delay



    Code:
    'PIC 12F683
    
    OSCCON = $60                    ' Internal oscillator frequency 4 Mhz
           
            
    TRISIO = %00000011              ' Set TRIS to all input
    ANSEL = %00000011               ' Analog channel RA0 & RA1
    ADCON0= %00000000               ' VDD as VREF
    CMCON0 = 7
    DEFINE ADC_BITS 8               ' ADC resolution 8 bit
    DEFINE ADC_CLOCK 1              ' Set clock source (rc = 1)
    DEFINE ADC_SAMPLEUS 11          ' Sampling time 11ms
    
    anpin0 CON 0                 ' Analog port pin RA.0
    anpin0val VAR byte            ' Value digital 0 - 255 
    
    
    anpin1 CON 1                 ' Analog port pin RA.1
    anpin1val VAR byte             ' Value digital 0- 255
    
    
    PAUSE 1000
    
    LOOP:
    
    adcin anpin0,anpin0val
    adcin anpin1,anpin1val
    
    pulsout porta.4,anpin0val
    pulsout porta.5,anpin1val
    
    
    pause 10
    
    
    goto loop
    Last edited by luminas; - 27th November 2010 at 14:02.

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