View Full Version : Need help on ADC : Software R/C filter
luminas
- 27th November 2010, 06:05
Instead of hardware R/C filer to delay ACD input, is it possible to do it with PBP ?
Ioannis
- 27th November 2010, 11:04
Depends on what you need.
FFT, Sorting and Average, DSP are some ideas.
What is your application?
What is your PIC?
What is your data to filter?
Maybe also your current program?
Ioannis
luminas
- 27th November 2010, 13:59
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
'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
HenrikOlsson
- 27th November 2010, 14:33
Hi,
The great Tracey Allen has a couple of filter routines here (http://www.emesystems.com/BS2math5.htm). Make sure you read thry the explaination as it describes how to alter the timeconstant etc. Then there's Darrels averaging routine (http://www.pbpgroup.com/modules/wfsection/article.php?articleid=7) which might be interesting as well.
/Henrik.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.