Slider Problems

Trackpads, buttons, sliders, or touch screens PSoC can do them all. This is the forum for CapSense.

Moderator: TedTsui

Slider Problems

Postby Danomyte » Tue Jul 20, 2010 2:02 pm

Hello,

I'm using the CY3214 Eval board and am trying to build a timer in which the time to be counted is set by a slider. When you slide the finger to the right, the time goes up, vice versa.

The slider is technically working, but the incrementing and decrementing isn't smooth - it's very jittery. For example, when I debug while my finger remains in one place, the centroid position jumps by a large amount (i.e. current position = 800, previous position = 60).

My settings are:

Finger Threshold: 100
Noise Threshold: 20
Baseline Update Threshold: 150
Sensor Autoreset: Enabled
Hysteresis: 10
Debounce: 3
Negative Noise Threshold: 20
LowBaselineReset: 50
Scanning Speed: Fast
Resolution: 12
Ref Value: 3

I used the USB to serial from AN2397 to view the counts and they look pretty good. Here's the code I'm using to detect the up and down (my C is pretty clumsy, so excuse me)

Code: Select all
if(!(CSD_bIsSensorActive(0)|CSD_bIsSensorActive(1))){   //make sure that the other two buttons on the board don't trigger this code
   current_position = CSD_wGetCentroidPos(1);
   if((current_position <= 0x03E8) //resolution is 1000
            &&((current_position > previous_position + 100)||(current_position < previous_position - 100))) // hysteresis to suppress jitter
   {
      if(current_position > (previous_position + 250))  //enables wrapping when finger reaches end of slider and starts from the other side
      {
         work_count = DOWN;
      }
      else if (current_position < (previous_position - 250))
      {
         work_count = UP;   //temporary test variable
      }
      else if (current_position < previous_position)
      {
         work_count = DOWN;
      }
      else if (current_position > previous_position)
      {
         work_count = UP;
      }


Any ideas?

Thank you!
Danomyte
Newbie
Newbie
 
Posts: 6
Joined: Sun Feb 21, 2010 9:31 am

Return to “%s” CapSense

Who is online

Users browsing this forum: No registered users and 1 guest