sir i have written this program to read touchscreen coordinates
butttt still a problemmmmm please help.
PIN 1 PA2
PIN 2 PA3
PIN 3 PD0
PIN 4 PD1
#include<compat/deprecated.h>
#include<multiutil.h>
#include<avr/io.h>
#include<util/delay.h>
int read_touch_x(void);
int read_touch_y(void);
int x,y;
int main(void)
{
lcd_init();
init_adc();
while(1)
{
x=read_touch_x();
y=read_touch_y();
write_command(0x85);
lcd_printi(x);
write_command(0xc5);
lcd_printi(y);
_delay_ms(400);
lcd_clrscr();
}
}
int read_touch_x(void)
{
cbi(PORTD,0);
cbi(PORTA,2);
int x_co=read_adc(3);
sbi(PORTD,0);
sbi(PORTA,2);
return x_co;
}
int read_touch_y(void)
{
sbi(PORTD,1);
cbi(PORTA,3);
int y_co=read_adc(2);
cbi(PORTD,1);
sbi(PORTA,3);
return y_co;
}
