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

Help me with touchpad application

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



Joined: 31 Jul 2008
Posts: 1

View user's profile Send private message Send e-mail

Help me with touchpad application
PostPosted: Fri May 13, 2011 10:23 am     Reply with quote

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

View user's profile Send private message

TOUCHDATA & TOUCHSTATUS
PostPosted: Sun Nov 04, 2012 11:19 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 04, 2012 3:21 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 04, 2012 5:24 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 04, 2012 6:37 pm     Reply with quote

Quote:
I'm only trying to use touchpads in more complex modes, like multitouch and long press.

http://www.ccsinfo.com/forum/viewtopic.php?t=48513
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Mon Nov 05, 2012 3:04 am     Reply with quote

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