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

HELP Capacitive Touch PIC16F726

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



Joined: 25 Oct 2004
Posts: 136

View user's profile Send private message

HELP Capacitive Touch PIC16F726
PostPosted: Sat Sep 08, 2012 8:54 am     Reply with quote

Hello Friends

I am running into a problem which drives me crazy.

I started a test for the touchpad features of this compiler, fancy enough it was working. I'm at the beginning but after some iterations I even can't get the easiest program to run.

Here is my code:
Code:

#include <16F726.h>
//#device ICD=TRUE
#fuses HS,NOWDT
#use delay(INTERNAL=8MHz)

#use touchpad(range = 18,scantime=32ms,threshold = 6,pin_b4='0',pin_b5 ='1',pin_a4='2',pin_a5 ='3')
#define num 2
#define OUT1          PIN_B0

INT i;

void main()
{

enable_interrupts(GLOBAL);
//touchpad_state(1);

while(TRUE)
{
   if(touchpad_hit())
      {
      i= touchpad_getc();
      switch (i)
         {
         case '1':output_high(OUT1);break;
         case '2':output_low(OUT1);break;
         case '3': output_high(OUT1);break;
         case '0': output_low(OUT1);break;
         }
      }   
}
}

So what is the problem ??

It works every time after the reset only once. I mean for one key, doesn't matter which one and after that it never detects a touchpad_hit !!!

I already read all forum posts with touch, but couldn't find any helpful answer.

Compiler Version: CCS PCM C Compiler, Version 4.107, 48988

OOPS: Pads are connected to Port A4,A5,B4,B5

Any suggestions are appreciated.

Best regards from Austria
Andreas
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sat Sep 08, 2012 4:04 pm     Reply with quote

What do you mean by:-
Quote:
It works every time after the reset only once.

Do you mean that OUT1 goes high which ever key you hit?

And OUT1 then stays high?

If not, please tell us exactly what does and doesn't happen.

Mike
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