6 Application Implementation

The application firmware is developed on a AVR128DA48 microcontroller, generated using:

  • Atmel START and Atmel Studio IDE
  • MCC and MPLAB X IDE
The implemented firmware is performed with the AVR128DA48 Curiosity Nano development board.

The MCU peripherals, TIMERs, SPI, USART, ADC, and ZCDs are used to implement the functionalities of the phase sequence detection using a three-phase power supply.

The Timer/Counter type A instance 1 (TCA1) is used for scheduling the tasks every 500 µs; it is configured to generate an interrupt for every 500 µs.

Timer/Counter type A instance 0 (TCA0) is configured to generate an overflow interrupt for every 20 ms. It is used for measuring the time in-between two ZCD interrupts, thereby calculating the phase-shift between the phases of three-phase input.

The SPI is used to integrate the waveform click for generating the three-phase emulated signal; it is configured in Master mode with a 6 MHz SPI clock (SPI_CLK) and a SPI data mode two.

The USART is used for communication between the host computer and application setup; it is configured with a 230400 baud rate.

The ADC is used for reproducing the input signal on the data visualizer (for demonstration) and also for three-phase RMS voltage measurement; it is configured with a 2 MHz ADC_CLK (ADC clock) and 126.3 kHz (0.79 µs) sampling rate.

The two ZCD instances are used for detecting the zero cross of the three-phase input signal; they are configured with interrupt on the rising edge signal.