background image

Atmel AVR262

 

 

3

8375A-AVR-03/11 

3 Application overview 

This demo application acquires the QTouch key sensed, generates the report, and 
sends it to a PC (host) on request. The application is built over the generic USB HID 
application, which allows a simple data exchange between the PC (host) and the 
device. The PC requests new, available QTouch data from the device on a regular 
polling interval. The device will send data if available. Otherwise, a NAK (no 
acknowledge) is sent to inform the PC that no data is available. The data package 
sent from the device to the PC is referred to as Report IN. 

Figure 3-1

 gives the generic overview of the application. 

Figure 3-1. 

Application overview.

 

 

The reports sent to the host contain a set of bytes that can be used by the user 
application. Because this application is using just eight QTouch keys, one byte is 
sufficient to transfer the touch status, though this can be modified depending on the 
requirement.  

In this application, port A and port C are used for touch sensing. When the SNS and 
SNSK pins are connected to the same port, the even pin numbers will be used as 
SNS pins and the odd pin numbers will be used as SNSK pins. 

  PA0, PA2, PA4, PA6  

Æ

  SNS0, SNS1, SNS2, SNS3 

  PA1, PA3, PA5, PA7  

Æ

  SNSK0, SNSK1, SNSK2, SNSK3 

The least-significant bit (LSB) of the report byte has the value of the sensor 
connected to PA0 and PA1. Similarly the next higher bit of the report byte has the 
value of the sensor connected to PA2 and PA3. The positions of the sensors in the 
report byte are shown in 

Figure 3-2

Summary of Contents for AVR262

Page 1: ...ability for different AVR USB devices Supports IAR and GCC 1 Introduction This application note illustrates how to use the QTouch Library on the AT90USB646 microcontroller to provide a single chip sol...

Page 2: ...2 Atmel AVR262 8375A AVR 03 11 2 Hardware requirements Atmel STK 600 Atmel STK525 or custom board Atmel QTouch sensor board USB host...

Page 3: ...Application overview The reports sent to the host contain a set of bytes that can be used by the user application Because this application is using just eight QTouch keys one byte is sufficient to tra...

Page 4: ...Touch data in report byte When a touch is sensed on a sensor connected to PA0 PA1 the value of the report byte is 0x01 and when it is sensed at PC4 PC5 the value is 0x40 The report byte values for th...

Page 5: ...root folder The library selection guide is also available on the Atmel website Select the technology as QTouch the MCU family as USB AVR the MCU type as 8 bit the MCU as Atmel AT90USB646 the tool chai...

Page 6: ...ese custom compilation options one by one refer to Figure 5 1 D_QTOUCH_ DQT_NUM_CHANNELS 8 DSNS1 A DSNSK1 A DSNS2 C DSNSK2 C DQT_DELAY_CYCLES 5 D_SNS1_SNSK1_SAME_PORT_ D_SNS2_SNSK2_SAME_PORT_ DQTOUCH_...

Page 7: ...Atmel AVR262 7 8375A AVR 03 11 Figure 5 2 IAR compiler options Figure 5 3 IAR assembler options...

Page 8: ...he help of a block diagram Figure 6 1 Firmware architecture The touch sensing and report generation are handled in hid_task c and touch_task c and their respective header files The various related fun...

Page 9: ...NEL_2 AKS_GROUP_1 10u HYST_6_25 qt_enable_key CHANNEL_3 AKS_GROUP_1 10u HYST_6_25 qt_enable_key CHANNEL_4 AKS_GROUP_1 10u HYST_6_25 qt_enable_key CHANNEL_5 AKS_GROUP_1 10u HYST_6_25 qt_enable_key CHAN...

Page 10: ...by the user qt_set_parameters configure timer ISR to fire regularly init_timer_isr 6 2 Touch library APIs 6 2 1 touch_measure The touch_measure function is responsible for measuring the touch sensing...

Page 11: ...he value of the touch_data variable changes and the host is updated with the new status Usb_select_endpoint EP_HID_IN if Is_usb_write_enabled return Not ready to send report if touch_data old_touch_da...

Page 12: ...note includes a GUI based PC host application that can be used to display which key is pressed or released The PC executable is available in the associated deliverables The respective key press or ke...

Page 13: ..._id 2725 Atmel AVR QTouch Library 4 3 http www atmel com dyn products tools_card asp tool_id 4627 Atmel AVR QTouch Library User Guide http www atmel com dyn resources prod_documents doc8207 pdf AVR328...

Page 14: ...tions 6 6 Firmware 8 6 1 Functions related to initialization 9 6 1 1 config_keys 9 6 1 2 CHANNEL_t 9 6 1 3 AKS_GROUP 9 6 1 4 10u 9 6 1 5 HYST_6_25 9 6 1 6 qt_init_sensing 9 6 1 7 qt_set_parameters 9 6...

Page 15: ...his document or in connection with the sale of Atmel products EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISC...

Reviews: