Well here I am... stuck again.
I'm trying to learn how to use the capacitive sensing module on the 16F726.
My first problem seems to be getting the sensing oscillator running.
I've been through the CSM section (14.0) of the data sheet and I've read AN1171 (Using the Capacitive Sensing Module on the PIC16F72X)
According to AN1171, once I've set the appropriate registers the oscillator should start up. At this point I would expect to see the oscillator running on my chosen sensor pin... right?
I've got my 'scope on pin 21 (RB0/AN12/CPS0/INT) of the PIC but I don't see anything except a few millivolts of 60 cycle hum. It just looks like a high impedance input with no oscillator running.
Shouldn't this be all it takes to get the CSM oscillator running on CPS0 (pin21) ?
Code:
'****************************************************************
Include "MODEDEFS.BAS" ' Include Shiftin/out modes
@ __config _CONFIG1, _DEBUG_OFF & _PLL_EN & _BORV_2_5 & _BOR_ON & _CP_OFF & _MCLRE_OFF & _PWRT_EN & _WDT_OFF & _INTOSCIO
@ __config _CONFIG2, _VCAP_RA0
OSCCON = $10 'set oscillator to 4 Mhz
TRISA= %11111111 'Set 'em all to inputs
ANSELA= %11111111 ' Set all pins to analog...
TRISB= %11111111 'all input
ANSELB= %11111111 'all analog
TRISC= %00000000 'Set portC all outputs
CPSCON0 = %10001101 'Cap sense on, high range oscillator
CPSCON1 = %00000001 'Cap sense channel input 0 is selected
Could someone please point me in the right direction?
Thanks!
Steve
Bookmarks