please dont rip this site

Resitive touch screen

This is just a sample how to read a 4-pin restive touchsceen

    int ADCvalue, x, y;
    //
    // Read X axis. Set RC1 Low, RA1 high, RC0 input (floating) and read AN0
    TRISCbits.TRISC0 = 1;
    TRISCbits.TRISC1 = 0;
    LATCbits.LATC1 = 0;
    TRISAbits.TRISA1 = 0;
    TRISAbits.TRISA0 = 1;
    LATAbits.LATA1 = 1;
       
    AD1PCFG = 0xfffe;   // AD0
    AD1CON1 = 0x0000;
    AD1CSSL = 0x0000;
    AD1CHS = 0x0000;    // AN0
    AD1CON2 = 0x0000;
    AD1CON3 = 0x0002;

    AD1CON1bits.ADON = 1;

    ADCvalue = 0;

    IFS0bits.AD1IF = 0;
    AD1CON1bits.SAMP = 1;
    __delay_ms(50);
    AD1CON1bits.SAMP = 0;
    while (!AD1CON1bits.DONE)
        ;
    ADCvalue = ADC1BUF0;
    x = ADCvalue/6; // Scale X-value
    //
    // Read Y axis. Set RC0 Low, RA0 high, RC1 input (floating) and read AN1
    AD1PCFG = 0xfffd;   // AD1
    TRISCbits.TRISC0 = 0;
    LATCbits.LATC0 = 0;
    TRISCbits.TRISC1 = 1;
    TRISAbits.TRISA1 = 1;
    TRISAbits.TRISA0 = 0;
    LATAbits.LATA0 = 1;
    AD1CHS = 0x0001;    // AN1
    ADCvalue = 0;

    IFS0bits.AD1IF = 0;
    AD1CON1bits.SAMP = 1;
    __delay_ms(50);
    AD1CON1bits.SAMP = 0;
    while (!AD1CON1bits.DONE)
        ;
    ADCvalue = ADC1BUF0;
    y = ADCvalue/10;    // Scale Y-value
    xprintf("\rTouch x:%4d y:%4d", x,y);

file: /Techref/Resisitive_Touch.htm, 1KB, , updated: 2017/4/14 07:36, local time: 2024/10/10 04:39,
TOP NEW HELP FIND: 
44.220.184.63:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.massmind.org/Techref/Resisitive_Touch.htm"> Resitive touch screen</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to www.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .