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
Bookmarks