Datasheet

39
9502A–AT42–07/08
AT42QT2160
9. Getting Started With the QT2160
9.1 Using the I
2
C-compatible Bus
The QT2160 is an address-mapped part. All commands and data transfers consist of reads
from, and writes to, memory locations.
9.2 Establishing Contact
To establish that the device is present and running, write a zero to it (see Section 9.3). Now read
a single byte (see Section 9.4). This byte should be the ID of the device (0x11). If this is the case
the device is present and running.
9.3 Writing to the Device
A write cycle to the device consists of a start condition followed by the I
2
C-compatible address of
the device (see Section 6.1). The next byte is the address of the location into which the writing
will start. This address is then stored as the address pointer.
Subsequent bytes in a multibyte transfer will be written to the location of the address pointer,
location of the address pointer +1, location of the address pointer +2 etc. This ends with the stop
condition on the
I
2
C-compatible bus. A new write cycle will involve sending another address
pointer.
It is possible to stop the write after the address pointer is sent if no data is required to be written
to the device. This is done when setting the address pointer for reading data.
9.4 Reading From the Device
A read cycle consists of a start condition followed by the I
2
C-compatible address of the device
(see Section 6.1). Bytes can then be read starting at the location pointed to by the address
pointer set by the last write operation. The address is internally incremented for each byte read
during a multibyte read.
The stop condition at the end of the transfer causes the internal address pointer to revert to the
value written during the last write operation. This means that if a set of data bytes needs to be
read many times (such as the status bytes) then it is not necessary to keep sending an address
pointer. It can be set to the first location and multibyte reads will always then start there.
9.5 Keys
The default setting of the QT2160 is for 16 keys with AKS disabled. This will be the default
setting when the device first powers up. A coin placed over any key can be used to pick up the
burst signal to see the activity on the keys as explained in Section 3 of the application note
“Secrets of a Successful Touch Sensor Design" which can be downloaded from the Quantum
area of the Atmel website.
The CHANGE
line will go low indicating there is new data to be read. Reading the status bytes
(address 2...6) will cause the CHANGE
line to go inactive, as the data has been read.
If a key is now touched, the CHANGE
line will go active again, indicating that there is new data
again. The CHANGE
line will remain active until the status location containing the status for that
key is read. If the CHANGE
line does not go low then it is likely the sensitivity of the key is not
high enough. The burst length should be increased to increase the sensitivity.