![]() |
AVR1631 - Energy Meter Reference Design with ATxmega32A4
Rev 1.0
|
Meter Calibration routine. More...
Go to the source code of this file.
Macros | |
| #define | USART USARTC1 |
| Select the USART to be used. | |
| #define | USART_PORT PORTC |
| Select which Port is used as USART. | |
| #define | UART_BSCALE_VALUE 0 |
| Configure USART Scale factor. Here,Selected as Zero. | |
| #define | UART_BSEL_VALUE 51 |
| Configure for Baud Rate Value E.g.:Target: Internal RC 32MHz (default) For 38400bps, UBRR = 32MHz/(16*38400)-1 = 51.08. | |
| #define | UART_CHARACTER_SIZE USART_CHSIZE_8BIT_gc |
| Define UART Character Size. | |
| #define | UART_PARITY_MODE_SIZE USART_PMODE_DISABLED_gc |
| Define UART Parity Mode. | |
| #define | OMEGA (float)0.07853982 |
| Define OMEGA = (2 * pi * (Freq / Fsampling) ) | |
Functions | |
| void | calibrate_current (void) |
| void | calibrate_no_load (void) |
| void | calibrate_phase (void) |
| void | calibrate_time (void) |
| void | calibrate_time_date (void) |
| void | calibrate_date (void) |
| void | calibrate_voltage (void) |
| void | calibrate_watt (void) |
| void | phase_calc (float, uint8_t) |
| void | read_tx_array (uint8_t cnt) |
| void | uart_getdata (uint8_t) |
| void | uart_print (void) |
Variables | |
| uint8_t | rx_buffer [10] |
Meter Calibration routine.
$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_calibration.h.
| void calibrate_current | ( | void | ) |
brief This function take the average of current for 30sec, caluculate the shunt constant and stores the calibration value into eeprom
/param volt_input holds the input data from the user /param calibration_temp accumulates the raw voltage value for calibration
Definition at line 309 of file meter_calibration.c.
| void calibrate_date | ( | void | ) |
brief This function updates the structure 'rtcTime' with the new date received through UART,
Definition at line 206 of file meter_calibration.c.
| void calibrate_no_load | ( | void | ) |
brief This function take the average of current at noload for 30sec, caluculate the offset current value and stores the calibration value into eeprom
/param calibration_temp accumulates the raw current value for calibration /param calibration_watt accumulates the raw active power value for calibration
Definition at line 220 of file meter_calibration.c.
| void calibrate_phase | ( | void | ) |
brief This function take the average of power factor for 30sec, caluculate the phase constants and stores the calibration value into eeprom
/param current_input holds the input data from the user /param calibration_temp accumulates the raw voltage value for calibration /param pf_temp calculates the actual power factor for phase calibration
Definition at line 505 of file meter_calibration.c.
| void calibrate_time | ( | void | ) |
brief This function updates the structure 'rtcTime' with the new time received through UART, RTC starts running with this new time
Definition at line 195 of file meter_calibration.c.
| void calibrate_time_date | ( | void | ) |
brief This function updates the date and time received through UART, RTC starts running with this new time
Definition at line 183 of file meter_calibration.c.
| void calibrate_voltage | ( | void | ) |
brief This function take the average of voltage for 30sec, caluculate the volt constant and stores the calibration value into eeprom
/param volt_input holds the input data from the user /param calibration_temp accumulates the raw voltage value for calibration
Definition at line 271 of file meter_calibration.c.
| void calibrate_watt | ( | void | ) |
brief This function take the average of active power for 30sec, caluculate the watt constant and stores the calibration value into eeprom
/param watt_input holds the input data from the user /param calibration_watt accumulates the raw active power for calibration
Definition at line 405 of file meter_calibration.c.
| void phase_calc | ( | float | pf_avg, |
| uint8_t | g_stage | ||
| ) |
brief This function calculate the beta(B1) and A1 values
Definition at line 592 of file meter_calibration.c.
| void read_tx_array | ( | uint8_t | cnt | ) |
brief This function load the array from flash
| tx_read[] | holds the data to be transmitted through uart |
Definition at line 172 of file meter_calibration.c.
| void uart_getdata | ( | uint8_t | tx | ) |
brief This function collect the calibration data from the user through UART
| rx_complete_flag | is set on receiving complete data from the user |
Definition at line 149 of file meter_calibration.c.
| void uart_print | ( | void | ) |
brief This function send the character in tx_read array into uart buffer
Definition at line 133 of file meter_calibration.c.