Application

This application is implemented as a simple data logger measuring an analog signal every 5th millisecond, using RTC to trigger the ADC sampling periodically. As the XMEGA A1U Xplained Pro board does not have any external components added to the analog input pins, a floating input pin will be used in this demo sample.

In this application the CPU is only needed to setup the peripherals and to perform the data processing (does nothing in this example, users can add their own routines). In order to reduce power consumption we can put the CPU in sleep whenever it is not in use, idle mode will be used to do this. In Idle mode the CPU and Flash program memory is stopped, while the peripheral clock and peripheral modules are kept running.

When an RTC overflows, it raises a event to trigger an ADC conversion.

When the ADC conversion is complete, the DMA will transfer the ADC conversion result to the data buffer. For simplicity this operation is called a "measurement cycle". After 64 measurement cycles, when the last ADC conversion is complete, the CPU is woke up by DMA complete interrupt and performs the data processing. This cycle (64 measurement cycles plus the data processing) is called a "complete cycle". DMA complete interrupt service route will re-assign destination address and reload DMA.

The following peripherals and functions are used:

The current consumption waveform is illustrated below:

The source project can be downloaded from Atmel | START by browsing examples. Atmel START is an innovative online tool for intuitive and graphical configuration of embedded software projects. For more information, refer to the Getting Started guide.