Please Read : This article was posted by me a long time ago, I am not able to monitor the comments regularly. So, if you need my help regarding any article, please write to me at dmehta17@gmail.com . I will try to answer the queries as quickly as possible. Also, please don't ask me for the code for any other controller except LPC2148, because I only have code for that controller. For any other controller, you will have to develop the code on your own based on the algorithm explained here. If you've created such code, I request you to share it with me via e-mail. I will publish it here with full credits to its original author.
--------------------------------------------------------------------------------------------------------------
I've always wanted to add something new to my projects. That's why in the 7th semester, when I saw a touch screen just lying in my college, I decided to go for it. Touch screens add an X-factor to otherwise ordinary projects. They are fun to use and more important, their applications are endless. In this article, I will explain how to interface a 4-wire resistive touch screen with microrocntrollers.
Resistive Touch Screens
Of all the kinds of touch screens available, Resistive touch screens are easy to interface, cheap and they have fair sensitivity.Resistive Touch screens are simply transducers. This touch screen has a resistive layers in both X and Y directions. According to the position of the touch, Their X channel and Y channel resistance changes. So, what we have to do is we have to determine the X and Y Channel resistance to get the position of the touch in terms of X and Y co-ordinates.
Here is an Image of simple resistive touch screen.
How To Interface Touch Screen with Microcontroller
To Interface Resistive touch screen with a microcontroller, you will need a microcontroller with inbuilt Analog-to-Digital converter having two or more channels. This is needed because, the touch screen will provide data in terms of an analog voltage on two different pins, using which, we have to determine position of the touch. Also, ADC input pins of the microcontroller should be configurable as General Purpose I/O (GPIO). As shown, in the figure, the touch screen has total of 4 wires coming out. Pin configuration is shown in the fig. To read the position of the touch, we have to first read touch position sequentially i.e. first read X position and then read the Y position. To do this, connect X1 and Y2 pins of touch screen to ADC multiplexed GPIO pins of the controller. And connect X2 and Y1 pins of touch screen to simple GPIO pins of the microcontroller.
Now first, we have to read X position of the touch, for that, u have to program the pin X1 as Logic high (+5v or +3.3v in some cases) and configure pin X2 as logic low (GND). Now, as I told earlier, touch screen contains a resistive layer in both direction. So, when we apply +5v and GND to its pins, it will create a voltage gradient in X direction. Voltage on the X channel will vary according to the X position of the touch. We have to measure this voltage to determine the X position.For that, configure Y2 as ADC input and configure Y1 to high impedance state (in most controller, configuring Y1 as "Input" will work). Then read the value from the ADC. It will give the relative value of the touch. For example, if you have an 8-bit ADC in the controller, when you touch near the right most end, it will give you a value of 255 and when you touch near the left most end, it will give you a value near 0. After reading X position, you will have to read the Y position. For that, configure Y2 as Logic High, Y2 as Logic Low, and X1 as ADC input and X2 as High Impedance state. After that, whole procedure is the same.
This way, you can interface touch screens with microcontrollers and add something new to your projects. I made a "Touch Screen Calculator" using the LPC2148 microcontroller. Below is the video of the Touch screen Calculator in action. If you need any help regarding this or have any suggestion/feedback, then write a comment here or mail me at dmehta17@gmail.com or you can connect with me on facebook at "http://www.facebook.com/damehta"
--------------------------------------------------------------------------------------------------------------
I've always wanted to add something new to my projects. That's why in the 7th semester, when I saw a touch screen just lying in my college, I decided to go for it. Touch screens add an X-factor to otherwise ordinary projects. They are fun to use and more important, their applications are endless. In this article, I will explain how to interface a 4-wire resistive touch screen with microrocntrollers.
Resistive Touch Screens
Of all the kinds of touch screens available, Resistive touch screens are easy to interface, cheap and they have fair sensitivity.Resistive Touch screens are simply transducers. This touch screen has a resistive layers in both X and Y directions. According to the position of the touch, Their X channel and Y channel resistance changes. So, what we have to do is we have to determine the X and Y Channel resistance to get the position of the touch in terms of X and Y co-ordinates.
Here is an Image of simple resistive touch screen.
How To Interface Touch Screen with Microcontroller
To Interface Resistive touch screen with a microcontroller, you will need a microcontroller with inbuilt Analog-to-Digital converter having two or more channels. This is needed because, the touch screen will provide data in terms of an analog voltage on two different pins, using which, we have to determine position of the touch. Also, ADC input pins of the microcontroller should be configurable as General Purpose I/O (GPIO). As shown, in the figure, the touch screen has total of 4 wires coming out. Pin configuration is shown in the fig. To read the position of the touch, we have to first read touch position sequentially i.e. first read X position and then read the Y position. To do this, connect X1 and Y2 pins of touch screen to ADC multiplexed GPIO pins of the controller. And connect X2 and Y1 pins of touch screen to simple GPIO pins of the microcontroller.
Now first, we have to read X position of the touch, for that, u have to program the pin X1 as Logic high (+5v or +3.3v in some cases) and configure pin X2 as logic low (GND). Now, as I told earlier, touch screen contains a resistive layer in both direction. So, when we apply +5v and GND to its pins, it will create a voltage gradient in X direction. Voltage on the X channel will vary according to the X position of the touch. We have to measure this voltage to determine the X position.For that, configure Y2 as ADC input and configure Y1 to high impedance state (in most controller, configuring Y1 as "Input" will work). Then read the value from the ADC. It will give the relative value of the touch. For example, if you have an 8-bit ADC in the controller, when you touch near the right most end, it will give you a value of 255 and when you touch near the left most end, it will give you a value near 0. After reading X position, you will have to read the Y position. For that, configure Y2 as Logic High, Y2 as Logic Low, and X1 as ADC input and X2 as High Impedance state. After that, whole procedure is the same.
This way, you can interface touch screens with microcontrollers and add something new to your projects. I made a "Touch Screen Calculator" using the LPC2148 microcontroller. Below is the video of the Touch screen Calculator in action. If you need any help regarding this or have any suggestion/feedback, then write a comment here or mail me at dmehta17@gmail.com or you can connect with me on facebook at "http://www.facebook.com/damehta"
Here is the 'C' code I've created for reading X and Y positions from the touch screen. The code is for Phillips LPC2148 controller.I've crated two functions : "xcoordinate" and "ycoordinate".When called, functions wait for a touch and when touch screen is touched, returns X and Y co-ordinate respectively.
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;
}
{
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;
}
cool but how could i do it with an avr.......
ReplyDeletecan u go in detail
@shyam....
ReplyDeleteyeah, definitely u can do that. Tell me which controller are u using.
Great job......really helpful......Thanx.......
Deletecud u show me hw 2 interface with atmega 32 and also provide the details for your touchscreen calculator...
can i use avr atmega8l
Deletewell ineed to know which software i should use to do programming paresh
ReplyDelete@ above :
ReplyDeleteWell, it depends on you. If you're using AVRs, you can use AVR Studio. If you're using ARM controllers like me, you can use SCARM or Keil also......
how to print a character in a touch screen?
ReplyDelete@Benedict Maxwell
ReplyDeleteYou can't display anything on the touch screen....
for that, I have fixed the touch on top of a Graphics LCD.....
how to feed information into the touch screen....
ReplyDelete@Hearthacker
ReplyDeleteYou don't have to feed any data to touch screen. As I mentioned earlier, Touch screen is a passive resistive sensor. YOu have to get the value by measuring the resistance between two nodes.
is dis same fr atmega series of controllers??
ReplyDelete@Prash : the procedure remains same for all the controllers, but the code I have written is for LPC2148 controller. For ATMega series, code will be somewhat different......
ReplyDeleteWill the programming for PIC microcontroller be easier than for LPC2148?...and how to display nos of the calculator on the lcd?
ReplyDeletesir how do we interface a glcd with a microcontroller?
ReplyDeletethank u
sahil
@Anonymous : That depends on which one you use most. I haven't tried PIC controllers yet. But if you are programming in 'C'. then everything is almost same.
ReplyDelete@Anynomous and Sahil : For displaying the contents on the Graphics LCD, you have to interface LCDs with controller. Also, interfacing depends on which type of LCD controller the LCD has. KS0108 is the most famous GLCD controller and many interfacing libraries are available for different microcontrollers online.
ReplyDeleteHello,
ReplyDeleteThis is similar to what i have to make... I have to program a touch screen with a php application using a microcontroller. What would be your opinion on doing this? What would be you approach?
your*
ReplyDelete@Raquel : First, make a code to interface touchscreen with microcontroller. Then you can use your PC-side PHP application to communicate with microcontroller through either serial port or USB port and get the touch data.
ReplyDeletenice work :)
ReplyDelete@uma : thnx....
ReplyDeletecan i do it with PIC 18 family ???
ReplyDeleteCan I use here 8051 Microcontroller...??
ReplyDelete@FiDO : You can do it with PIC18 family, but you will have to find a controller from PIC18 series which has 2 GPIO/ADC configurable lines and enough free GPIO lines to interface graphics LCD. I don't have the PIC18 code for the that, but you can transform this code to PIC18.
ReplyDelete@Bimal : If you're talking about simple 8051 controllers (e.g. AT89C51 or AT89S51), you can't interface the touchscreen with them.
ReplyDeleteIs there a special external adc converter to interface with controller ...
ReplyDeletegive me other mc that i can use....
I m having a project of resistive touch screen interfaced with mc.and to have keypad on touchscreen.so can u suggest me which mc i can use..and also adc converter..
@Bimal : if you want to use external ADC, use dedicated touch screen controllers instead. You can find them on Atmel or Microchip site. Also, I suggest you to choose controller which has internal ADC as interfacing touch screen will be easier that way. Such controllers are LPC21xx series (Phillips), Atmel ATMega series and PIC24/ PIC32 series....
ReplyDeletethis is cool can u help me how to interface touch screen to pic 18f452
ReplyDeleteFirst, try some codes for accessing ADCs of PIC18F452.... Then get a touch screen and go through the procedure I have written to get position of touch on the touch screen.
Deletewould u like to give me (assembly or c)code that you have written for phillips,same for atmega16??..
ReplyDeleteHi.. Go through the article again. I have given the code to access the touch screen in the article. But, you will have to modify it for ATMega16
DeleteHi,
ReplyDeleteThat was a good one. infact a great for beginner. have you tried for capacitive???
Thank you..
DeleteNo, I haven't tried this for capacitive touch screen, but I think that it will be more or less similar to this one. The only main change will be that there will be some additional circuitry that will convert change in the capacitance between two plates into respective voltage change. After that, everything will be same.
Hi Mehta,
DeleteI Googled for Touch Screen Interfacing and i found your blog it was good. but could u share some snaps regarding interfacing etc......
maddy_xyz420@yahoo.com
Hi Mehta,
ReplyDeleteI Googled for Touch Screen Interfacing and i found your blog it was good. but could u share some snaps regarding interfacing etc......
maddy_xyz420@yahoo.com
which kind of snaps do you want ?
Deletethe interfacing part......
Deleteand the x,y cordinate position.......
and how you got that calc app on the screen.... etc.......
Like I have mentioned in the post, I have used a monochrome Graphics LCD for displaying the calculator. I have put the transparent Touch-Screen on the top of the LCD, so it seems that they both are same. Also, I have posted the code for reading the X and Y position of touch screen, which will work on LPC2148 microcontroller.
DeleteHi gud wrk..
ReplyDeleteI am also searching for this. And i also want to interface with PC i.e with this program i will get co-ordinates.In place of mouse to PC i want to use this as connecting the output of the microcontroller to PC by interfacing with USB.
Totally what the theme is i want to operate the PC with touch screen not with mouse i am researching about that..
Can u help me??
For that what i have to modify in code?
Can u mail me the details at saranyasai.s@gmail.com or else post here. It is important me. Please reply..
Thank u..
I have mailed you the details....
DeleteHi,
ReplyDeleteWhy can't touch screen be interfaced with 8051 family of microcontrollers?
We could use an external ADC for it like ADC0809. Wont it work?
@SAM : For interfacing touch screen, you need to create voltage gradient in one direction (for example in X-direction ) and read the voltage in other direction ( Y- Direction ) and repeat this in other direction. For creating this voltage gradient, you have to use two microcontroller lines as GPIO (means you can set them as either '0' or '1' ) and other microcontroller line as ADC input. Now reading voltage in other direction needs this to be reversed, so microcontroller lines that acted as GPIO, needs to act as ADC input and other lines need to act as GPIO. External ADCs like ADC0809 doesn't provide this type of ADC/GPIO multiplexed functionality, so you can't use touchscreen with external ADCs.
ReplyDeleteRight, Got the concept...Thanks..
ReplyDeleteYou can stay in touch with me on: www.facebook.com/embeddedsystems
Hi dhaval i want to make touchscreen display which can replace notice boards in d collgs n i dnt hv ny informtn regarding dis n dis is my final yr prcjt n der is only 1 month to go so plz tell how i shld start n wat steps i shld follow to accomplish it?? N plz post as early as possible or can send me d details at vachipatel_24@yahoo.com n if possbl plz send me today so dat i can cmplt within reqrd time
ReplyDeleteThanx in advance
Waiting for u quicker response
@Anonymous : If you are thinking of notice boards, on college, I don't think touch screen is an appropriate solution as the size of notice boards will be very large. Also, first of all, decide the type and size of the LCD that you want to use i.e. monochrome LCD or RGB color LCD. It depends on the type of content you want to display on the noticeboard. Based on that, decide which controller you want to use and in the last, select appropriate sized touch screen.
ReplyDeleteI wanna to use monochrome lcd n size of lcd can b dat of mbl phn.....n i jst want to create menu on that display so when i touch dat menu its content are opened
DeleteI decide to use monochrome lcd now of which company n which controller n touch screen also d size of dis display shld b dat of mbl phn n i jst wanna to display menu so whnevr i touch it its contents r displayed
ReplyDelete@Anonymous : with the specifications you have given, I suggest you use a KS0106 based graphics LCD. Also, you can use either PIC32 controller or ATMega controller depending on your familiarity with either one. After that, try to interface the GLCD with the controller and try to display the menu that you wanted to. Now for touch screen, I think you should use small sized touch screens that are used in mobile phones. They are cheap and easily available in various sizes. So, buy one touch screen with the same size as the LCD and follow the steps I have mentioned in the article to interface the touch screen.
DeleteThanks dhaval very much
ReplyDeletehello dear
ReplyDeletei want to do this with Atmel 8085 microcontroller...
can u plz guide me ?
@Ruler : Refer to my earlier comment about whether 8051 can be used for interfacing touch-screen or not. The same applies for 8085 too. It should answer your question.
ReplyDeleteHi, Is this thing only work with 32-bit MCU's only or with all the things?
ReplyDeleteIt is not necessary to use 32-bit microcontroller. You can use any controller that has all the features that I have mentioned in the article. Though you will have to change the code according to your microcontroller.
ReplyDeletei was trying to interface touchscreen with at-mega16....
ReplyDeletei m not getting the desired output...
here is what i am doing after referring your blog..
while(1)
{
sbi(DDRA,x1); // pin where x1 is connected as o/p
sbi(PORTA,x1); // logic 1/5v on x1
sbi(DDRA,x2); // pin where x2 is connected as o/p
cbi(PORTA,x2); // Gnd/Logic 0 on x2
cbi(DDRA,y1); // pin where y1 is connected as i/p(high impd)
x = readADC(4); //Function will read an analog voltage form y2
_delay_ms(100);
sprintf(line,"X:%03d",x);
lcd_display(line,LINE1);
sbi(DDRA,y1); // pin where y1 is connected as o/p
sbi(PORTA,y1); // logic 1/5v on x1
sbi(DDRA,y2); // pin where y2 is connected as o/p
cbi(PORTA,y2); // Gnd/ logic 0 on y2
cbi(DDRA,x2); //pin where x1 is connected as i/p(high impd)
y = readADC(1);
_delay_ms(100);
sprintf(line,"Y:%03d",x);
lcd_display(line,LINE2);
}
PORTA is an ADC PORT
x1 is pin 0
x2 is pin 1
y1 is pin 2
y2 is pin 3
what is the output that you are getting ?
ReplyDeleteYou can do one thing, first, remove the code to chk Y axis, and read the voltage with multimeter on the ADC pin. Something like this :
---------------------------------------------------------------
sbi(DDRA,x1); // pin where x1 is connected as o/p
sbi(PORTA,x1); // logic 1/5v on x1
sbi(DDRA,x2); // pin where x2 is connected as o/p
cbi(PORTA,x2); // Gnd/Logic 0 on x2
cbi(DDRA,y1); // pin where y1 is connected as i/p(high impd)
while(1)
{
x = readADC(4); //Function will read an analog voltage form y2
_delay_ms(100);
sprintf(line,"X:%03d",x);
lcd_display(line,LINE1);
}
TRISA1=0; __delay_ms(1); X1=1; // 5V
ReplyDeleteTRISE0=0; __delay_ms(1); X2=0; // GND
TRISE1=0; __delay_ms(1); Y1=0; //GND
TRISA2=1; __delay_ms(10); xm=measure(2); //read adc Y2
//measure y
TRISE1=0; __delay_ms(1); Y1=0; //GND
TRISA2=0; __delay_ms(1); Y2=1; //5V
TRISE0=0; __delay_ms(1); X2=0; //GND
TRISA1=1; __delay_ms(10); ym=measure(1); // read adc X1
untouched time x=0,y=0
when touch max x value=350 max y value=400
when touch min x value=20 min y value=20
@Anonymous : That's it...you have interfaced the touchscreen. You can make a function for it. Also, whenever you read the X value or Y value, subtract 20 from the value to get the absolute value.
Deletein india from where i can buy touchscreen LCD? -Nishant
ReplyDelete@Nishant : You can get Touchscreens from any big mobile repair stores. Many of the touchscreens used in the mobile phones are resistive touchscreen.
ReplyDeleteThank you for ur valuable one.
DeleteWill u please mail me all the details for that Project?
1.How to draw the Lines or pic in Touch Screen?
2.What Touch Screen hav u Used?
Then Etc...,
My Mail Id ; amanikandan.be89@gmail.com Plese Urgent.
Thank You,
Manikandan A
For drawing lines on the GLCD, I used a library which provided a function using which, I could turn any pixel on or off. By using this library, I was able to draw lines / display picture.
DeleteAs I have mentioned in the article, I've used Resistive Touch Screen for this project.
This is a great project. Thank you for a thorough explaination. Can you please to provide details on how to draw graphics on a GLCD? I only had experience in programming a character LCD, not a GLCD before. I could not find any information on the web for a beginner like me when it comes to GLCD. Thank you very much in advance.
DeleteExcellent!!
ReplyDeleteis there an arduino library or code that I can have for this?? If yes, please send to rajvignesh@edindia.co.in
I have the code for ARM7 based controller. I am sure that you will be able to find the library for this on Internet...
Deletesir ,
ReplyDeletem using atmega16 can u please tell me whole circuit.and how to give clock to touchscreen.Thanx
Since this is a Resistive touch screen, you don't have to give clock to the touch screen.
Deletepls give me details about glcd and is the relation between touch and glcd
ReplyDeleteplease send the codings of 4wire touch screen interface with atmega 16 controller
ReplyDeletemy mail id
selvam27193@gmail.com
Hi, I haven't tried this with ATMega16, but the core part remains the same. All you have to do is make your own routines for ADC interfacing.
Deletehi sir,
ReplyDeletei am very impressed with this articles and your replies,i am going to try with ARM controller LPC2119/2129.i need circuit diagram to interface with LPC 2119 and full details about this project and if you have any other projects like this,send the details to mail id( nataraj87@gmail.com ) please do the needful.
Thank you
sir how do we interface touch screen with avr atmega16 microcontroler??
ReplyDeleteHere is a very interesting project that shows how to interface touch screen with AVR
Deletehttp://www.sparkfun.com/tutorials/139
plz i want to know how hardware are connected "diagram plz "
ReplyDeletePlease leave me a mail on dmehta17@gmail.com
Deleteplz give me code for 4 wire resistive touchscreen to interface with avr atmega8L
ReplyDeleteHere is a very interesting project that shows how to interface touch screen with AVR
Deletehttp://www.sparkfun.com/tutorials/139
This comment has been removed by the author.
ReplyDeleteHi i actually interfaced 4 wire resistive touch screen with 8051. I used an external ADC0804 for analog to digital conversion, Mux-demux 74HC4053 for touch screen configuration as tabulated at above and AT89C51 for processing. I am about to complete my final semester project on "wireless home automation with touch screen interfacing" though there is no graphical LCD interfaced. Because the c51 used can not provide the proper refresh rate for graphical LCD. If any one want this project as well as code then u can contact me "saugatdai@gmail.com". Thank you D.A.M for knowledge about touch screen!
ReplyDeleteYou are welcome...
DeleteMaybe you can take it a step ahead and build it on AVR / PIC / ARM based controllers. It can be very useful in learning how to interface GLCD.
@anonymous
Deletehai it a great work am to working on the touch screen interface with c51 an d i have left only two day to complete so can you send me the details of the "wireless home automation with touch screen interfacing" that you have done so that it will be very useful for me please kindly mail me at "rajkamall007@gmail.com" today or as soon as possible please thank you
sir can u tell me how may i know where i have to touch on screen for special function.how can diagram display on touch screen so that we can identify which buten i have to press for switch on device or off device ..........could u please send me detail of circuit diagram and other document at "rjkumar221@gmail.com" its urgent sir i want to make project for my final year.
ReplyDeletesir,i need to a capacitive touch screen.then what will be the reading procedure for that?
ReplyDeletei want to interface with pic16f877a so plz suggest me and also send me some materials if u have
ReplyDeletewould u please mail me the circuit diagram of lpc2148 interfacing with glcd and touchscreen,along with the project details. Thanks in advance
ReplyDeleteHeres my id :kumaruday691@hotmail.com
so u r actually simultaneously need both x and y coordinates,......but actually sequentially reading both coordinates.......how's that possible....?????....will it be dependent on the clock.....i mean how much time is required to calculate both the coordinates.....so that they are available simultaneously both ports...
ReplyDeletecool but how could i do it with atmega32.......
ReplyDeletecould i do it with atmega32....... pl send me code at shailesh4440@yahoo.co.in
ReplyDeleteHi thank you for the post and also i want to know what is high impedence state and also this touch screen will give analog output right should i use ADC to read that and where the pins are connected can you please reply me at the earliest.
ReplyDeleteI am using at89c51 which requires external ADC. i want to know which pin is connected to what or please explain me what is high impedance state.
ReplyDeleteThank you.
my project is image based password authentication using touch screen .i googled and find all the hardware requirement like 4wire resitive touch screen,graphical lcd,steeper motor with driver ,buzzzer ,pic16f72 microcontroller ,led.how to start these thing to interface.
ReplyDeletecan u plz give me the C code of interfacing touchscreen with glcd using atmega16?i'm unable 2 undrstand the code you have written
ReplyDeleteSir, i've interfaced 4 wire resistive touch screen with atmel 8535 and sending the adc values to terminal but i am not able to get proper values.. it shows alphabets, numbers and symbols..
ReplyDeletePlease help..
here is ma code for touchsccreen:
#include
#include
#include
#define y1 PA3
#define x2 PA2
#define y2 PA1
#define x1 PA0
void USARTInit(unsigned int);
char receive();
void transmit(char data);
void ADC_init(void);
unsigned int ADC_read(unsigned char);
uint16_t adc_result0, adc_result1;
char int_buffer[10];
int main()
{
char data;
/*First Initialize the USART with baud rate = 9600bps
for Baud rate = 9600bps
UBRR value = 95
*/
USARTInit(95);
ADC_init ();
//Loop forever
while(1)
{
//Read X
DDRA |= (1<>8);
/*Set Frame Format
>> Asynchronous mode
>> No Parity
>> 1 StopBit
>> char size 8
*/
UCSRC=(1<<URSEL)|(3<<UCSZ0);
//Enable The receiver and transmitter
UCSRB=(1<<RXEN)|(1<<TXEN);
}
//This function is used to read the available data
//from USART. This function will wait untill data is
//available.
char receive()
{
//Wait untill a data is available
while(!(UCSRA & (1<<RXC)))
{
//Do nothing
}
//Now USART has got data from host
//and is available is buffer
return UDR;
}
//This fuction writes the given "data" to
//the USART which then transmit it via TX line
void transmit(char data)
{
//Wait untill the transmitter is ready
while(!(UCSRA & (1<<UDRE)))
{
//Do nothing
}
//Now write the data to USART buffer
UDR=data;
}
void ADC_init(void)
{
ADMUX=(1<<REFS0); // AVcc with external capacitor at AREF
ADMUX |= (1 << ADLAR);
ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); // Enable ADC and set Prescaler division factor as 128
}
unsigned int ADC_read(unsigned char ch)
{
ch = ch & 0x07;
ADMUX =(1<<REFS0)|ch;
ADCSRA|=(1<<ADSC); // start conversion
while(!(ADCSRA & (1<<ADIF))); // waiting for ADIF, conversion complete
ADCSRA|=(1<<ADIF); // clearing of ADIF, it is done by writing 1 to it
return (ADC);
}
can we interface AT89S52 with a 4 wire resistive touch screen by any means (prefer it to be cheap)....
ReplyDeletecan any one help me pls how can i connect touch screen with my PIc18F97J60 controller.is it possible to interface.if yes i want a source code for that.pls guys help me out
ReplyDeletekindly waiting for your reply
can i interface capacities touch screen with pic ????
ReplyDeleteGreat Admin this stuff is nice!!
ReplyDeleteTouchscreen
can anyone tell me how to interface the capacitive touchscreen ???
ReplyDeletehiii
ReplyDeletei want to interface touch screen to avr 328p controller using i2c pins can you help me.
hii,
ReplyDeletei want to Ft5426dq8 capacitive screen code.do you know capacitive touch ?????
Capacitive Touch Monitors For sale
ReplyDeleteCool and that i have a tremendous present: How Long Renovate House house renovation advice
ReplyDelete