Hello experts..
I want to interface resistive touchscreen with
8051 microcontroller using embedded C (KIEL)
Can anyone tell me how to match the pattern of
X and y coordinate generated from touch screen
Using EMBEDDED C. Basically I want to learn the
Algorithm. PLEASE HELP
The design depends of several factors. The clear touch screen is going to lay over a display screen or possibly just a printed card. You simply display the buttons and then the area being touched that corresponds to the area being touched is used to branch in the code.
If you have 4 to 6 touch buttons it is an easy problem and there are many touch screen controllers (TSC) that can interface with a 8051. As an example see the Ti TSC2100 ( ignore the codec functions) to see how a TSC with a SPI interface would be used. You might have a X =0 or 1 and Y = 0, 1, or 2. My guess is since you are using a 8051 this is what you are looking at. As an example the bottom right button might be "increase motor speed" as seen on the display. In a loop you test the TSC, so
if X=1 and Y=2 (the area near the bottom right of the display)
then increment the variables that increase motor speed.
In summary you only need to know which of 4 to 6 areas of the screen was touched.
If your problem is similar to the TSC in the Apple iPad I'm typing this on then it works a bit differently and it is a much more complex TSC device since there will be more rows and columns overlaying a HD screen. For this you will need to know the row and column the displayed image pixels occupy and align them with the row and column being touched. In addition you will need complex algorithms to decide if a touched row and column as seen by the TSC aligns with an object displayed on the screen or if a nearby screen object makes more sense given the context. This step is to improve the user's experience and reduce errors.
i want to design gesture based output control(output can be stepper motor, DC motor etc). like, i can make straight line or L shape or square on touch screen and depending upon the shape output will be controlled. NO GRAPHIC LCD, i am using simply touch screen.
Ok, how many bits of x and y? Asked another way how large is the screen and what resolution (.1mm? 1 mm? Other?) do you need?
There are advantages to using a TSC. You should do a search and see what is available and their cost. Many will connect directly to the screen and have a SPI interface to the 8051 with very few additional components.
For your application the ADC in the 8051 could be used but you will have to design the analog interface. It is not complex but it is more parts and will take back some of the cost saved by not using a TSC.
I am not using readymade TSC . Instead using a touch screen connected to ADC via multiplexer(yes, this is analog interface what i have to use for cost reduction and better understanding of the circuits). Suppose my hardware is ready and now i wanted to read the X,Y cordinate(in terms of voltage 0 to 5 volt which in tern can be scaled down if required) and match any predefined pattern. So how we will do that in EMBEDDED C CODE. I hope u got my point. waiting for your reply. THANK YOU in advance.
P89LV51RD2: 8051 based CMOS controller with PCA, Dual DPTR, WDT,32 I/O lines, 3 Timers/Counters, 7 Interrupts/4 Priority Levels,64K Bytes ISP FLASH, 256 Bytes on-chip RAM, 768 Bytes XRAM
TOUCHSCREEN: simple 4 Wire touchscreen of any mobile. you consider any standard size.. i just want to understand the logics.