ADC only Capacitive Touch

Status
Not open for further replies.

IMSlo

Newbie level 6
Joined
Oct 1, 2006
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,499
Microchip recently put out a PDF describing how to use only ADC for Capacitive Touch Sensing. It works on the voltage divider principle. I stumbled upon Cap Touch while looking for something else and became very interested in it.

My ultimate goal is to use thumb tacks stuck in a wooden board for my shop switches.

I now have this procedure working. It is written in JALv2. I will not try to learn assembly again.

The sensor I am using is a piece of aluminum foil about 1 1/2 square under 1/8" / 3mm Lexan.

The code works with this set up. It may or may not work with another type of sensor or even if the wire is lengthened. I have already tried with a thumb tack and it does not work.

I have a statement in my code that say "if measure < 175 then" meaning the sensor has been touched. The 175 is the problem. I want this number to adjust according to the capacitance in the sensor. I have a line of code that should do this but it does not work and is commented out. The line is Average =( (average * 15) + measure )/16). I know my code shows an 8 for the * I made that mistake when I put it back in for this discussion.

When I leave this line in the code the program the numbers go crazy and it locks down on touched with very small numbers.

I cant handle 10 bit math. Look at the line "measure = ADRESH + ADRESL. I get an 8 bit number from this probably left justified. I don't know what ADCON1 defaults to.

To sum all this up I would like to get the average thing working and maybe get 10 bit adc resolution.

I am attaching the following files,JAL, ASM, HEX, 01298A PDF and a picture of my breadboard setup.
 

Attachments

  • 16f88ADCTouchCap-LCD.rar
    6.4 MB · Views: 129

Average =( (average * 15) + measure )/16)

that would work.

and you can even change it slightly to multiply once.

I cant handle 10 bit math

...

measure = ADRESH + ADRESL

your chance of getting this done is nil if you don't know how to do 10-bit math.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…