4.7 Source Code Overview

The key peripherals and parameters used in the source code are:

  • Main clock (CPU, peripherals) frequency: 10 MHz
  • Peripherals
    • RTC
      • RTC clock frequency: 1.024 kHz
      • PIT period: 1024 cycles (1 second)
    • SLPCTRL
      • Sleep mode: Power-Down
    • DAC
      • Voltage reference: VDD (3.3V by default on CNANO board)
      • Output voltage: 1.0V
    • ADC
      • Clock frequency: 1 MHz (main clock divided by 10)
      • Voltage reference: VDD (3.3V by default on CNANO board)
      • Sample accumulation: 16
      • PGA gain: 16x
      • PGA bias current: 100%
    • USART
      • Baud rate: 115200
  • Interrupts
    • RTC PIT Interrupt (RTC_PIT_vect)

The following figure shows the high-level flow of the code:

Figure 4-1. High-level flow of current sensing code