1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

AR1020 Touch Controller

Discussion in 'Microcontrollers' started by AtomSoft, Mar 26, 2010.

  1. DirtyLude

    DirtyLude Well-Known Member

    Joined:
    Aug 5, 2003
    Messages:
    1,904
    Likes:
    56
    Location:
    Toronto, Canada
    The IC gives you both position and pressure data. It's also better for battery operated items since powering a uC's ADC takes power and it can't sleep during that time unless you poll over longer intervals. The touchscreen IC's are low power and provide wake up interrupts for a uC.

    You could still try the tsc2046:
    http://www.electro-tech-online.com/threads/tsc2046-controller-and-nds-touchscreen.92141/
     
  2. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    Thanks for the info Dirtylude. :)

    I've used low power with the PIC directly controlling touchscreen by using sleep/WDT and only reading one ADC after each wakeup. Then if Y>min the PIC knows the screen is touched and comes out of sleep to do both Y and X readings.

    I know some people like using these peripherals ICs for every task imaginable but I guess I'm a bit "old school". I like it best if it can all be done by the one PIC . ;)
     
  3. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Id rather use a ic for a couple reasons.. Less code for me.. Spi/i2c is simple as is and to have a external interrupt is nice. Also its more precise than what i would create...

    I do use both software and hardware versions so im not saying to use a ic only but there are advantages... Like if you need more adc pins etc...
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France

    Hello

    I do not understand well x,y reading function from edman222 : touchPress();
    Could you please explain me the last lines of the function:

    Code (text):
    void  touchPress (void)
    {
    ...
    pen = (pen>>7)&0x00FF;
    yhi = (((yhi<<7)|ylo)&0x0FFF);  // set it to a 0-1024 type thing
    xhi = (((xhi<<7)|xlo)&0x0FFF);
    }
    I would like to use AR1020 with a 128x64 GLCD screen,

    Once touchPress(); has been ran, how should i use the returned results : xhi , yhi, pen in order to compare them with a user defined area , i mean something like a button drawed in the GLCD ?

    Is a calibration mandatory ?

    Many thanks for your help,
     
    Last edited: Aug 14, 2011
  6. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    I usually like to scale the values from the touchscreens to be the same as the pixel X and Y coords.

    So if touchscreen X is 0-1023 I convert it to screen pixel X 0-127 like this;
    scrX = (tpX / 8);

    The TP coords are easier to use if they roughly match screen pixel coords.

    I don't think so. If you need to draw on the screen and get the pen tip matching an exact pixel then maybe. But generally the TP output is fairly linear and if you glue the TP onto the GLCD straight it will always be within a couple pixels of the right value. For buttons and simple screen controls that is plenty accurate enough.
     
  7. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    (To Crocu)- You PM'ed me, I will answer here as I don't like using PMs for stuff which already has it's own thread (and benefits everybody).

    The answer is; Sorry I don't use the AR1020 controller, and don't have any code for it. I use the touch controller directly with 4 PIC pins as I never saw the need to buy a special chip when you can just use 4 PIC pins (two of them ADC inputs).

    Maybe someone who uses the AR1020 can help you with the specifics for that controller IC?
     
  8. edman222

    edman222 Member

    Joined:
    Jan 3, 2011
    Messages:
    70
    Likes:
    2
    Location:
    Everywhere
    Crocu, My code just takes the data and combines the two upper and lower bytes of the X1 X2 and Y1 Y2 position into one X Y... it is easier to handle a single int rather than two chars (X1 X2) ... that way you can scale it or put it into a dot drawing algorithm for the screen..

    Calibration is necessary if you want to draw on the screen or have a touch screen keyboard... if you want large buttons it doesn't matter to much...
     
  9. crocu

    crocu Member

    Joined:
    Feb 20, 2009
    Messages:
    118
    Likes:
    1
    Location:
    France
    Thanks edman222

    But, what does do :
    Code (text):
    pen = (pen>>7)&0x00FF;
    Why 'pen' is usefull in the result function ?

    --

    Have you wrote a calibration function, something like "click in each angles of the screen", i do not know how to do it .
     
  10. Shi Xian

    Shi Xian New Member

    Joined:
    Aug 6, 2017
    Messages:
    1
    Likes:
    0
    I have still problem. Can i look at your code? Thanks a lot.

    Moderator edit: displaying your e-mail address on the forum is an invitation to spammers. Deleted.
     
    Last edited by a moderator: Aug 6, 2017
  11. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,392
    Likes:
    593
    Location:
    Peterhead, Scotland
    ONLINE
    This is a very old thread, 2 minutos has not been seen here for over six years.

    JimB
     

Share This Page