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 support@ccsinfo.com

Capacitive Touchpad

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



Joined: 06 Nov 2011
Posts: 13

View user's profile Send private message

Capacitive Touchpad
PostPosted: Mon Dec 05, 2011 12:45 pm     Reply with quote

hI

I want to use capacitive touchpad of the 16F1825. I try this code and he work very well for detect a push on touchpad:
Code:

#USE TOUCHPAD (RANGE=L , THRESHOLD=4, SCANTIME=32 , L_Touch='L', S_Touch='S')
TOUCHPAD_STATE(1);
enable_interrupts(GLOBAL);
...
   while(1)
      {
      PushTime =0;
      while (!TOUCHPAD_HIT());
      c=touchpad_getc();
     

      output_high( PON_Sound);
      delay_ms(500);
      output_low( PON_Sound );
     
      }


this work well

But I want to test a long push:
Code:

   while(1)
      {
      PushTime =0;
      while (!TOUCHPAD_HIT());
      c=touchpad_getc();
     
     while (TOUCHPAD_HIT())
        {
        c=touchpad_getc();
        delay_ms(50);
        PushTime+=1;
        }

      if (PushTime >= AppuiLong ) output_high( PON_Light);
      else output_high( PON_Sound);
      delay_ms(500);
      output_low( PON_Light );
      output_low( PON_Sound );
     
      }

Here the "TOUCHPAD_HIT()" function is a little strong with me.

After a "TOUCHPAD_HIT()" it's necessary to have a "c=touchpad_getc();" function to read pushed touch and reset state of "TOUCHPAD_HIT()" to 0.

And at this moment while I haven't release the touchpad, the "TOUCHPAD_HIT()" state is false and the "while" condition is false. Then I can't detect a long push (over 800ms).

Someone have an idea ?

or the original code of the CCS"capacitive touchpad " Built-in function
_________________
______________________

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