Continue to Site

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.

  • 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.

AR1020 Touch Controller

Status
Not open for further replies.
No problem :) Let me know if you ever figure out how to do the screen calibration, I couldn't get mine to work..

Good luck with your project!
 
Edman i have a question, in your data packet do you got data smaller to 1 byte? because the smallest data that i get is 9 bits. Thanks.
 
Uhh i'm not sure what you mean. When I receive the touch data its 8 bits (0000 0000) I don't know why you would get a 9th one, that may be an i2c issue.. are you sure you are not in 10bit mode on your i2c or something..?
 
Oh yes i receive the (0000 0000) data but when i touch the right border i get (11 1111111) 9 bits and when i touch the left border i get ( 1111 11111111) 12 bits, i think that i need to calibrate the system. Did you get another data, for example in the right border a data near to zero. i think that in the right border i should get data near to zero.
 
i need to calibrate the system, i read the datasheet and it is the problem. im trying to calibrete the system. thanks
 
Perhaps, but that would require more math and cpu time if you wanted to do something more complicated then just simple pen movements. The ar1020 can detect Penup,down,location,screen calibration,speed of pen moving and adjust pen sensitivity, and you only need to read it when its touched, ( no need to keep sampling it ).
But yea i was considering going to the ADC but got a bit lazy with how the code would integrate.... :p
 
Edman222-
The ar1020 can detect Penup,down,location,screen calibration,speed of pen moving and adjust pen sensitivity, and you only need to read it when its touched, ( no need to keep sampling it ).

Most of those features are available from a 2chan ADC solution. You just use an interrupt to sample the X adc then the next interrupt to sample the Y adc, and after the second interrupt you have the X and Y values of where the pen is. If there is no pen contact both adc values read 1023. All that is needed is a couple of resistors, and 4 PIC pins where 2 of the pins have adc capability.
 
2 minutos: Can you please post the source code to show how you calibrated the driver? I've been struggling with it for what seems like months. I've had one successful calibrate but haven't been able to reproduce it.
 
Last edited:
This is like the worst touch sensor i know heh.. you have to read a address then calculate the new address to write to ? wtf is that :D

I should have read this good before buying it. Ima order me some new touch sensors... non Microchip! heh

I hear TI has some good ones!
 
you only do that once... when you boot it up, not every time you read/write to it. At least thats how iv'e used it.
 
Ar1020 i2c

Has anybody a working I2C solution for the AR1020? I'm now working 2 days on different issues and at this point of time I'm able to get at least some acknowledges from the circuit, but not able to get data back. My feeling is that I'm doing something wrong subject to the command settings.
Is there any boddy willing to provide me some sample code (C or ASM) for the I2C operation?
Thanks
 
Hey ive been trying this IC still with some progress but no luck! Ill attach a image of my logic analyzer result... the data returned is wrong... or should be that... why am i getting this? faulty IC ? from all the testing ?

This is my SPI Code... (Mixed from microchips sw lib and my own code)

Code:
unsigned char WriteSWSPI( unsigned char output)
{
    char BitCount;                  // Bit counter
    volatile char input=0;
    
    BitCount = 8;                   // Do 8-bits
    
    SW_SCK_PIN = 0;
    SW_DOUT_PIN = 0;                // Set the Dout pin according to
    
    for(BitCount=0;BitCount<8;BitCount++)
    {
          input <<= 1;
          SW_SCK_PIN = 1;
          
          if(output&0x80)
            SW_DOUT_PIN = 1;
          else
            SW_DOUT_PIN = 0;
                   
          if(SW_DIN_PIN == 1)
            input|=1;
          else
            input&=0xFE;

          SW_SCK_PIN = 0;
          
          output <<= 1;

    }    
    
    return(input);                  // Return the received data
}
 

Attachments

  • LogicAR1020.jpg
    LogicAR1020.jpg
    79.3 KB · Views: 290
Juts taking a guess, but shouldnt the data output pin be stable for the entire time the SCK is high? So you should output the bit and allow a couple uS for the pin voltage to stabilse then do the SCK pulse.

Like this;
set output pin
2uS wait
make SCK hi
appropriate delay see datasheet for SCK hi period?
read input pin
make SCK low
appropriate delay see datasheet for SCK low period?
 
the datasheet sucks heh i dont see SPI timing ... exact timing at least.. i tried your code with no change but i altered my original code and got this which is correct... but the next time i try to do a command i get crap...

OK:
logicar10201-jpg.52346


BAD:
logicar10202-jpg.52347


Code:
unsigned char WriteSWSPI( unsigned char output)
{
    char BitCount;                  // Bit counter
    volatile unsigned char input=0;
    
    SW_SCK_PIN = 0;
    SW_DOUT_PIN = 0;                // Set the Dout pin according to
    
    for(BitCount=0;BitCount<8;BitCount++)
    {
          input <<= 1;
          
          if(output&0x80)
            SW_DOUT_PIN = 1;
          else
            SW_DOUT_PIN = 0;

          SW_SCK_PIN = 1;
                             
          if(SW_DIN_PIN == 1)
            input|=1;

          SW_SCK_PIN = 0;
          output <<= 1;

    }    
    
    return(input);                  // Return the received data
}
 

Attachments

  • LogicAR10201.jpg
    LogicAR10201.jpg
    19 KB · Views: 596
  • LogicAR10202.jpg
    LogicAR10202.jpg
    26.8 KB · Views: 574
Last edited:
I notice i wasnt polling the SIQ line but i am now and it stops at 0x55, 0x02

I send this:
send-jpg.52348


This is what i get back,...
rec-jpg.52349


Supposed to be 0x55,0x02,0x00,0x13

Why the heck is this causing so many issues. Am i the only one to think this IC is crap ? It cant just be me. To have to work so hard to get a simple touch screen ic working is a shame. Ive gotten harder things working (no nasty intentions :D )
 

Attachments

  • send.jpg
    send.jpg
    13.7 KB · Views: 544
  • rec.jpg
    rec.jpg
    29.6 KB · Views: 573
Last edited:
See my post #29. I do a heap of touchscreen stuff. It's so easy and 4 PIC pins and 2 resistors are all that is needed. Your's probably already using 4 PIC pins for that SPI mess. :)

You just read the ADC twice, once for X once for Y. Then you have XY of where it was pressed. Sample it in an interrupt every 2mS or so. Then just add some simple debounce etc in software so you need to get 2 very similar XY readings in a row to equal a valid read.

I have no idea why someone would want to use a pain in the butt specialty IC to do something as simple as read an XY touchpanel. It's like using a specialty chip to read 2 pots. ;)
 
Last edited:
I had it working using the pics adcs but wanted to get it working using the ic since i bought 2. Ill still check your post to see how you did it though thanks... Check my blog for a video on it working with adc pins..
 
Status
Not open for further replies.

Latest threads

Back
Top