Page 1 of 1

Anyone have a simple code snipped for Cap sensing (CTMU?)

Posted: 30 Aug 2012 05:57
by jasonaaronfox
I have a hobby project I'm working on that involves cycling through sixteen cap sense buttons with a Texas instruments multiplexer. Allowing for only one pin to sense all sixteen inputs. I already have the code running for controlling the multiplexer.

The only problem I'm running into is the lack of an mtouch library in microc and the only examples I can find being morbidly complicated implementation.

I can work with pic16,18, or 24. Any example for any of those families will work.

I appreciate the input all!

Re: Anyone have a simple code snipped for Cap sensing (CTMU?

Posted: 06 Sep 2012 15:04
by filip
Hi,

I'm afraid that we don't have this multiplexer at our office, so we are unable to help you,
but I'm sure that some of our user have experience regarding this.

Regards,
Filip.

Re: Anyone have a simple code snipped for Cap sensing (CTMU?

Posted: 06 Sep 2012 16:36
by jasonaaronfox
filip wrote:Hi,

I'm afraid that we don't have this multiplexer at our office, so we are unable to help you,
but I'm sure that some of our user have experience regarding this.

Regards,
Filip.
You misunderstood me. i already have the cpde for the multiplexer written, i am only lookung for a simple example of capacitive touch on one channel, one pin.

Re: Anyone have a simple code snipped for Cap sensing (CTMU?

Posted: 18 Sep 2012 12:27
by johnt
Microchip do a tricks and tips application note that gives a way to do this sort of thing.
Essentially you use one GPIO pin to charge a cap and add a resistor chain with your
buttons along it. You then use a timer to time how long it takes to charge
the cap and this tells you which button was pressed. Their example suggests
16 buttons can be used on a pin - thats seems optimistic to me but maybe
the resolution can be that good.
and I dont know how it would apply to your capacitive panel though (I'd be interested in how you get on)
It may be possible to adapt it.
Their tricks and tips notes are well worth a read for anyone who hasn't seen them.
(search "tricks n tips" in their main site)

Re: Anyone have a simple code snipped for Cap sensing (CTMU?

Posted: 18 Sep 2012 23:16
by jasonaaronfox
Well, my idea was to use a set of multiplexers that are all controlled from the same four pins using bcd. That way you can scan as many cap touch channels * 16 as you have available. I.E. four cap touch pins would each service 16 buttons through the multiplexing lattice; each giving a full resolution. I've got the CTMU code nearly completed, but the issue I ran into is that the compiler of my preference (mikroc) does not yet provide support for multiple adcon1 registers as seen in some pic18 and pic24 chipsets. I need to get down to the nitty gritty and use ASM to access the registers during the CTMU setup, but that's beyond my current coding capabilities.

Re: Anyone have a simple code snipped for Cap sensing (CTMU?

Posted: 19 Sep 2012 11:18
by johnt
Sorry I havn't used that module but perhaps there is an example on microchips site somewhere (most of their
examples tend to be in assembler) - you might get a response on their forum if no one else here has any ideas
but it doesn't seem to be very active.

edit
Looking for keypads myself I stumbled across AN1250 which describes a matrix touch keypad using the CTMU
with assembler code. Just thought it worth a mention here for anyone looking.

Re: Anyone have a simple code snipped for Cap sensing (CTMU?)

Posted: 28 Sep 2023 11:23
by cuhnkedrik@gmail.com
My plan was to employ a bank of multiplexers that could be programmed with bcd and so operated from a single set of four pins. If you have 16 cap touch channels, you can scan all of them at once. For example, the multiplexing lattice might allow just four cap touch pins to service 16 buttons at full resolution. I've nearly finished writing the CTMU code, but I came into a snag when trying to take advantage of additional adcon1 registers present in some pic18 and pic24 chipsets, which my preferred compiler (mikroc) does not currently support. During the CTMU setup, I need to go down to the nitty gritty and access the registers through ASM, but that's beyond my present coding talents.

Re: Anyone have a simple code snipped for Cap sensing (CTMU?)

Posted: 19 Dec 2023 09:08
by salmawisoky85@gmail.com
Capacitive touch sensing involves detecting changes in capacitance when a conductive object, such as a finger, comes into proximity with a capacitive touch sensor. This change in capacitance can be measured and used to detect touch inputs.