I have a 16F690, that I'd like to use in a capacitive touch sensor setup.
I should set out my stall, I'm still very new to PIC programming & the confusing array of registers to set!
The first part of getting capacititive touch sensors to work with the PIC, is to setupthe PIC's comparators in a relaxation oscillator config.
I can't get it to work! (so I've essentially failed at the first hurdle!)
Here's their simple schematic here (source = http://ww1.microchip.com/downloads/e...tes/01171B.pdf) ...

...which I've mapped the same 16f690 pins 'in play' here...

that said, I don't understand why there are two 16f690 pins with C12IN- on them pins 15 & 18 as seen on this datasheet pinout extract...

So RC0, RC1 & RC4 are the only ones of importance to get the relaxation oscilator, erhm oscillating! (or maybe RA1 - depending on which C12IN- Pin I should be using! What's the difference between the two pins marked c12in-?)
Microchip have released an application note which outlines the register settings needed to setup the relaxation oscillator on a 16F887 - http://ww1.microchip.com/downloads/e...tes/01101a.pdf Appendix A (but not a 16f690), so I needed to translate these register settings over to the 16F690, which as it turns out, I reckon are the same as the 16f887 anyway...
Code:
CM1CON0 = %10010100
CM2CON0 = %10100000
CM2CON1 = %00110010
SRCON = %11110000
VRCON = %10000111
but I'm struggling with the ANSEL register. On the 16f690, it seems that there are two ANSELS in play (ANSEL & ANSELH), and if my understanding is correct, these registers setswhether the corresponding pins are analogue or digital. So for the relaction oscillator, they'd need to be analogue.
If I'm reading the pic16f690 datasheet correctly ( http://ww1.microchip.com/downloads/e...Doc/41262C.pdf )
it seems that the only analogue pins I'm using are
RC0 (Pin 16 , AN4)
RC1 (Pin 15, AN5)
RC4 is not an analogue pin?
RA5 (Pin 18, AN1, again not sure if it's this C12IN- or the other one on pin 15!)
therefore should my ANSEL register look something like this...
Code:
ANSEL= %00110001
ANSELH = 0
Any other input greatfully received!
PS I've read the post by byte_butcher (http://www.picbasic.co.uk/forum/show...t=byte_butcher) , but he used a 16F726 which has an inbuilt capacitive sensing module - I'd rather stick with the 16f690 which is apparently capable of capacitive touch sensing too.
Bookmarks