Capacitive touch example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Capacitive touch example

895 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by swisstronics on Wed Jul 20 06:25:08 MST 2011
I'm using a LPC Expresso with a LPC1114/302 and Keil MDK. When I try to run the capacitive touch example from the AN11023 and the cap plates of the PCF8883 it doesnt work. I can't even see a discharge curve of the plate. The output is always high. It seems that the GPIO is always a digital output and is never switched to analog input. I'm using the original example code from NXP. Does anybody know about this problem? Thank you for your advice.
0 Kudos
Reply
2 Replies

790 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Wed Jul 20 16:02:00 MST 2011
Hello swisstronics,

It should work!

Like Zero suggested, put all the files in a working directory.
Using Keils uVision: make a new project. In the project the following files should be added: startup_LPC11xx.s , system_LPC11xx.c and main.c

If you are not sure the software is running, enter the following few lines. The leds will blink 5 times after power startup.

Put these lines under:
[FONT=Courier New][SIZE=2] SysTick_Config(SystemCoreClock/100); // interrupt each 10 ms[/SIZE][/FONT]
[FONT=Courier New][SIZE=2] [/SIZE][/FONT]
[FONT=Courier New][SIZE=2]// 5 times led blinking[/SIZE][/FONT]
[FONT=Courier New][SIZE=2] for (i=0; i<=5; i++)
{[/SIZE][/FONT]
[FONT=Courier New][SIZE=2]  counter = 20;
  while(counter);             // wait 20 * 10 mSec = 200 mSec
  LPC_GPIO3->DATA &= ~(1<<3); // P3.3 low = LED ON
  counter = 20;  [/SIZE][/FONT]
[FONT=Courier New][SIZE=2]  while(counter);             // wait 20 * 10 mSec = 200 mSec
  LPC_GPIO3->DATA |= (1<<3);  // P3.3 high = LED OFF
}

[/SIZE][/FONT]The variable 'counter' should be defined at the beginning of the program.

Add in the Systick_Handler() the following line in the main loop:
[FONT=Courier New][SIZE=2] if (counter > 0) counter--;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][/SIZE][/FONT]
[FONT=Courier New][SIZE=2]


[/SIZE][/FONT]
0 Kudos
Reply

790 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Jul 20 07:15:20 MST 2011

Quote: swisstronics
...I can't even see a discharge curve of the plate...



If you can't see a discharging all 10ms there's something terrible wrong. Copying this AN code to a new LPCXpresso project and just adding 2 resistors and a capacitor and this sample is working :eek::eek:
0 Kudos
Reply