![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
geralds
Joined: 17 Dec 2008 Posts: 3
|
Proximity sensor using the PIC12F1840 |
Posted: Wed Dec 31, 2014 10:27 am |
|
|
How can i use the build in touchpad function for a proximity sensor using the PIC12F1840?
In the compiler there is the pre-processor function #use touchpad.
Then there are the build in functions touchpad_getc(), touchpad_hit(), touchpad_state() .
But this functions are not working right with the PIC12F1840.
It seems that this functions are not the best for creating a proximity sensor.
-> The goal is a proximity sensor touching a distance between > 5mm and < 25mm.
But also a direct touching contact on the sensor area does not work correctly.
E.g. as a normaly touch-button.
Some times also for testing this pin was open - it seems that the "button is always pressed", because the oscilloscope screen shows allways "low".
Normaly i think that minimum an oscillating signal must be shown. - nothing of them is on the sensor pin.
Please, have you a hint or a tip, or a workaround how can i program with / or without ? / this build in functions?
In the ccs-forum i found nothing about this.
Because the hardware area is very small i use the PIC12F1840.
-> the functions are:
One proximity sensor_input, / pin RA4;
one PWM_output for a power LED, / pin RA2;
one chipselect_output for the controlled amplifier, /pin RA5;
one current-feedback_input from the controlled amplifier, /pin RA0;
one voltage-feedback_input for measuring the batterie voltage. /pin RA1;
All this other functions are working right, but the proximity sensor not.
Many thank's for helping, for some tips.
regards
geralds |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Wed Dec 31, 2014 1:42 pm |
|
|
Getting close to 25mm, will depend very much upon the design of the pad. Getting this right is the hardest part. Have a look at AN3863 from Freescale.
Semtech also do some good application notes on this. A 'hand' at 25mm, yes. A finger will be hard, and very prone to incorrect sensing.
Do a basic program, and post it. There are a lot of settings you have to get right to use the touchpad library.
To use a variable distance sensing, you have to use the testmode operation, and handle the numbers in the array yourself.
I posted code a while ago for using the CVD module, which was simply based on the flowchart in the data sheet. You may well need to do the same for the CPS module.
It's not going to give anything approaching sensible readings, till calibrated since the settings depend on the layout of your pad, wiring, signals nearby, etc. etc.. |
|
![](templates/subSilver/images/spacer.gif) |
geralds
Joined: 17 Dec 2008 Posts: 3
|
|
Posted: Sun Jan 25, 2015 11:54 am |
|
|
Hi,
thank you for this tip.
Now today, since 14 days, the proximity sensor using the PIC12F1840 works.
I found help in the Microchip framework "mTouch".
Now the distance is 4mm through a wooden housing.
Then, i will compile this with the ccs compiler too.
So now i just need adjusting the parameters for optimum working distance.
Gerald
---
Last edited by geralds on Sun Jan 25, 2015 2:36 pm; edited 1 time in total |
|
![](templates/subSilver/images/spacer.gif) |
guy
Joined: 21 Oct 2005 Posts: 291
|
|
Posted: Sun Jan 25, 2015 2:14 pm |
|
|
Don't forget that the oscilloscope probe affects the sensing ![Cool](images/smiles/icon_cool.gif) |
|
![](templates/subSilver/images/spacer.gif) |
geralds
Joined: 17 Dec 2008 Posts: 3
|
|
Posted: Sun Jan 25, 2015 2:45 pm |
|
|
yes, that's true. Here are Chip 'n' Dale they help me switching right the oscilloscope. ![Cool](images/smiles/icon_cool.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|