int x; PINSEL0 = (PINSEL0 & 0x3FFF3FF0) | 0x00000005; // Configure pins for touch screen PINSEL1 = (PINSEL1 & 0xC3FFFFFF) | 0x10000000; IO0DIR = (IO0DIR & 0xDFFF7F7F) | 0x00008080; IO0SET = IO0SET | 0x00000080; // Set pin to '1' IO0CLR = IO0CLR | 0x00008000; // Set pin to '0' AD0CR = ( AD0CR & 0xFFD00000 ) | 0x00200208 ; // Start the ADC
can anyone tell me the pins I need to connect in my board according to the code
Is there a page missing from your reference manual pdf file?
#include<lpc214x.h> // Header file for Phillips LPC2148 controller #include<stdio.h> #define CCLK 30 #define PCLK 10 #include<uart.h> #include<stdlib.h> int x; int y; int xcoordinate(void); int ycoordinate(void); void delayms(unsigned int ms); #define DAC_BIAS 0x00010000 int main(void) { xcoordinate(); ycoordinate(); } void delayms(unsigned int ms) { T0TCR = 0x02; T0TCR = 0x01; while( T0TC < ms); T0TCR = 0x00; } int xcoordinate(void) { int x; PINSEL0 = (PINSEL0 & 0x3FFF3FF0) | 0x00000005; // Configure pins for touch screen PINSEL1 = (PINSEL1 & 0xC3FFFFFF) | 0x10000000; IO0DIR = (IO0DIR & 0xDFFF7F7F) | 0x00008080; IO0SET = IO0SET | 0x00000080; // Set pin to '1' IO0CLR = IO0CLR | 0x00008000; // Set pin to '0' AD0CR = ( AD0CR & 0xFFD00000 ) | 0x00200208 ; // Start the ADC while(1) { delayms(10); AD0CR = ( AD0CR & 0xF8FFFFFF ) | 0x01000000 ; xchkadc: x = AD0DR3 & 0x80000000 ; if(x == 0x80000000) // Check if A-D conversion is complete { x = 0x00000000; x = AD0DR3 & 0x0000FFC0; x = x >> 6; x = x & 0x000003FF; if(x <= 10) { goto xexit; } AD0CR = AD0CR & 0xF8FFFFFF; return x; // return the value of touch in x direction } goto xchkadc; xexit: AD0CR = AD0CR & 0xF8FFFFFF; } return 0; } int ycoordinate(void) { int y; PINSEL0 = (PINSEL0 & 0x3FFF3FF0) | 0xC0000005; // Configure pins for touch screen PINSEL1 = (PINSEL1 & 0xC3FFFFFF) | 0x00000000; IO0DIR = (IO0DIR & 0x9FFFFF7F) | 0x60000000; IO0SET = IO0SET | 0x40000000; //// Set pin to '1' IO0CLR = IO0CLR | 0x20000000; //// Set pin to '0' AD1CR = (AD1CR & 0xF0D00000) | 0x00200220 ; //// Start the ADC while(1) { delayms(10); AD1CR = ( AD1CR & 0xF8FFFFFF ) | 0x01000000 ; ychkadc: y = AD1DR5 & 0x80000000 ; if(y == 0x80000000) // Check if A-D conversion is complete { y = 0x00000000; y = AD1DR5 & 0x0000FFC0; y = y >> 6; y = y & 0x000003FF; if(y <= 10) { goto yexit1; } AD1CR = AD1CR & 0xF8FFFFFF; return y; // return the value of touch in y direction } goto ychkadc; yexit1: AD1CR = AD1CR & 0xF8FFFFFF; } return 0; }
this is a code for touch screen interface which I got from net...I don't understand which pins I should connect on my arm7 board to get the touch coordinates in lcd
Whats wrong with your reference manual?
The code you 'found' is very ugly. Maybe if you knew more about what you're after then you'd recognise something better.