View previous topic :: View next topic |
Author |
Message |
olegfl
Joined: 31 Jul 2008 Posts: 1
|
Help me with touchpad application |
Posted: Fri May 13, 2011 10:23 am |
|
|
I use PIC16F1937 with CCS Compiler. I have to run Touchpad application with one button. I would ask about TOUCHDATA.
I want to see the difference between pressed button and not pressed. May I see it with TOUCHDATA?
What does kind of key data it include?
How can I use it?
I am interested in small example. |
|
|
maxtn
Joined: 04 Nov 2012 Posts: 2
|
TOUCHDATA & TOUCHSTATUS |
Posted: Sun Nov 04, 2012 11:19 am |
|
|
I'm experimenting in touchpad too but ccs help doesn't explain how
the variables TOUCHDATA and TOUCHSTATUS are managed.
I discovered that the bit before the MSB of the 16bit TOUCHSTATUS defines if the pad is pressed or not (bit=1 -> pressed, bit=0 -> not pressed) and the lower 8 bit of the varible defines which cap. pin is pressed.
I can't find the principle for check which pin is pressed.
Also the variable TOUCHDATA is unknown.... it's an array but I can't find how to use it...
Anyone can help me?
Many thanks in advance!!!
Max |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 04, 2012 3:21 pm |
|
|
Those are internal variables used by the #use touchpad() library and are
not supposed to be used by you.
Apparently you are studying the .LST file to see how the library code
works. To see the library code in the .LST file, you need to comment
out the #nolist statement at the top of the PIC's .h file, like this:
Quote: |
//////// Standard Header file for the PIC16F1937 device ////////////////
#device PIC16F1937
//#nolist
|
Then re-compile and you'll see the library code. |
|
|
maxtn
Joined: 04 Nov 2012 Posts: 2
|
|
Posted: Sun Nov 04, 2012 5:24 pm |
|
|
Thank you for your answer, but I'm only trying to use touchpads in more complex modes, like multitouch and long press.
The CCS help mentions the variable TOUCHDATA to explain the TOUCHPAD_STATE() function:
TOUCHPAD_STATE (state);
state:
0 : Normal state
1 : Calibrates, then enters normal state
2 : Test mode, data from each key is collected in the int16 array
TOUCHDATA
but CCS help doesn't explain anything else.
Thanks
Max |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Mon Nov 05, 2012 3:04 am |
|
|
Actually the manual entry is telling you everything you need to know about TOUCHDATA.
it is an int16 array, and it has an entry for every key you define. So if you set the touchpad up to use six keys it is created by the compiler as:
unsigned int16 TOUCHDATA[6];
To use this, you have to switch the touchpad state to the test mode, so:
TOUCHPAD_STATE(2);
All it does is stores the corresponding AD readings. Nothing more.
As PCM programmer says, if you want more abilities, than basic keypress, then you need to go DIY.
Best Wishes |
|
|
|