Just a wild guess...
What if bit 6 of the T1GCON register is set to 0?
Just a wild guess...
What if bit 6 of the T1GCON register is set to 0?
Dave
Always wear safety glasses while programming.
Ioannis,
Try this modification to the averaging routine for the CSM.
http://www.picbasic.co.uk/forum/show...598#post107598
DT
I wanted to correct minor mistakes in the comments of the code I posted but it is not possible. Can any of the moderators or Admins see the whole code? I cannot for sure (in the Edit Post mode).
Dave, I have not changed the T1GCON register which by default on Power up is reset to zero. I do not use the gate anyway.
Darrel, I missed that. Will try it an get back.
Thanks both,
Ioannis
I use the CSMs with great success without having to average.
I basically store away the last cap sense output reading (ie TMR1 count), take the present reading (the TMR1 count again) and just have the program calculate an ongoing 'trigger' threshold count (the threshold being the last TMR1 reading reading minus a certain percentage)
And then just code it along the lines of if the present reading just takenis less than the threshold (ie the last reading minus a preset percentage), then the sensor has been touched....set a flag variable.
There should be a huge amount of difference between the non touched count & the touched count ...I set my threshold at something like 30% and it trigger everytime.
One thing i've found helps greatly with CSM ...is to adjust the CSM oscillator settings & also the sample period so that you get a 'normal' reading in the 10,000->15,000 count ballpark.
Last edited by HankMcSpank; - 5th December 2011 at 21:37.
Thanks Hank. Well, 30% seems too much to me. I have managed up to 16%...
Thanks Darrel too. Yes your suggestions did made alot of difference.
Ioannis
After some testing, it seems that with the modification Darrel suggested, it needs to touch very quickly to get a 'pressed=1' flag.
If you approach relatively slow the touch pad it won't get triggered. I may have to play with the constants in the CSM and average too.
But it made a very reliable system now.
Thanks for the tips.
PIC16f1827 with the internal CSM module makes it very easy to make a touch keyboard. Only a couple of registers to setup and you are ready.
Ioannis
Yes the deviation from the 'normal' (no finger nearby) CSM output count, is related to how long the sample period is vs how long you actually touch the sensor for.....also the physical composition of the sensor itself, and how moist your finger is!
So a quick touch might only see a 5% deviation from the normal count, whereas a long sensor press, will see the CSM output count plummet.
Last edited by HankMcSpank; - 6th December 2011 at 16:18.
Bookmarks