CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Proximity sensor using the PIC12F1840

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
geralds



Joined: 17 Dec 2008
Posts: 3

View user's profile Send private message

Proximity sensor using the PIC12F1840
PostPosted: Wed Dec 31, 2014 10:27 am     Reply with quote

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Wed Dec 31, 2014 1:42 pm     Reply with quote

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..
geralds



Joined: 17 Dec 2008
Posts: 3

View user's profile Send private message

PostPosted: Sun Jan 25, 2015 11:54 am     Reply with quote

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
guy



Joined: 21 Oct 2005
Posts: 297

View user's profile Send private message Visit poster's website

PostPosted: Sun Jan 25, 2015 2:14 pm     Reply with quote

Don't forget that the oscilloscope probe affects the sensing Cool
geralds



Joined: 17 Dec 2008
Posts: 3

View user's profile Send private message

PostPosted: Sun Jan 25, 2015 2:45 pm     Reply with quote

Idea yes, that's true. Here are Chip 'n' Dale they help me switching right the oscilloscope. Cool
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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