![]() |
AVR1631 - Energy Meter Reference Design with ATxmega32A4
Rev 1.0
|
Meter initialisation. More...
#include "meter.h"Go to the source code of this file.
Functions | |
| void | tamper_check (void) |
| ISR (PORTB_INT0_vect) | |
| This function is executed whenever the LCD key is pressed. | |
| ISR (PORTC_INT0_vect) | |
| This function is executed on key press. | |
| ISR (PORTD_INT0_vect) | |
| This function is executed whenever the power off is detected It will switch on the battery and CPU goes to power save mode. | |
Variables | |
| uint8_t | rtc_flag = 0 |
| uint8_t | key_flag = 0 |
| uint8_t | magnetic_tamper_flag = 0 |
| uint8_t | cover_open_flag = 0 |
Meter initialisation.
$Revision: 1.0
$Date: 2012-07-01 10:10:10 +0530
Copyright (c) 2008, Atmel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file meter_task.c.
| ISR | ( | PORTB_INT0_vect | ) |
This function is executed whenever the LCD key is pressed.
| key_flag | is incremented on each press and is cleared on reaching the top value |
Definition at line 114 of file meter_task.c.
| ISR | ( | PORTC_INT0_vect | ) |
This function is executed on key press.
| key_flag | is incremented on each press and is cleared on reaching the top value |
check for cover open pin status
check for magnetic tampering
check if PIN5_bm is pressed
Definition at line 134 of file meter_task.c.
| ISR | ( | PORTD_INT0_vect | ) |
This function is executed whenever the power off is detected It will switch on the battery and CPU goes to power save mode.
| key_flag | is incremented on each press and is cleared on reaching the top value |
Definition at line 171 of file meter_task.c.
| void tamper_check | ( | void | ) |
This function checks for different types of tampering such as earth fault current reversal, neutral cut, magnetic tampering
check for earth fault tamper (Load earthing)
compare the phase current is within 12% of the neutral current
if tampering persist for 15 secs update the led status
check the status for Current Reversal tampering
if tampering detected toggle the TAMPER_CURRENT_REVERSAL LED
check the status for Neutral CUT tampering and configure the status led
check the status of Magnetic tamper flag and update the LED
Definition at line 58 of file meter_task.c.