|
|
View previous topic :: View next topic |
Author |
Message |
joonho
Joined: 17 Oct 2012 Posts: 3
|
Touchpad function problem |
Posted: Wed Oct 17, 2012 1:03 am |
|
|
Guys I'm trying to figure this out but I can't help it.
I'm currently using 4.104 version of the program and somehow, "#use Touchpad" part cannot be compiled. Does it have anything to do with the version that I'm using? Or what could be the problem. Although I use the example code "#use touchpad", it does not work as well. Here is what I've tried to compile. Please help me out here! Thank you!
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;
}
}
}
} |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19529
|
|
Posted: Wed Oct 17, 2012 1:40 am |
|
|
As a comment you need to be selecting Vcap.
On this chip there basically has to be an external capacitor to smooth the internal regulator on one of A0, A5 or A6. This is set by the fuses (VCAP_A0 etc..). This needs to be setup and working.
The manual for 4.104, does not list the touchpad functions. It was just about at the point when these functions were starting to appear. Functions that are not yet in the manual are normally covered in the 'readme; with the compiler, and the one for 4.104, does not list the touchpad functions yet. 4.107, has them listed in the manual.
So I'm afraid your compiler is just too old.
Best Wishes |
|
|
joonho
Joined: 17 Oct 2012 Posts: 3
|
|
Posted: Wed Oct 17, 2012 9:25 pm |
|
|
Thank you so much! I appreciate it! |
|
|
|
|
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
|