header of the VAC More...
#include <xc.h>
#include "vac_monitor_typedef.h"
#include "../../../revision.h"
#include "../sources_common/Totempole_Application_Setup.h"
Go to the source code of this file.
Macros | |
#define | rnd(a) ((uint16_t)((a)+((a)<0?-0.5:0.5))) |
rounding floats to uint16_t | |
#define | min(a, b) ((uint16_t)(((a)>(b)) ? (b):(a))) |
min of 2 integers | |
#define | max(a, b) ((uint16_t)(((a)>(b)) ? (a):(b))) |
max of 2 integers | |
#define | FCALL_AC_MONITOR (1.0/10.0e-6) |
frequency at which AC monitor code is executed (in Hertz) | |
#define | AC_SENSE_GAIN (37.585e-3) |
gain between AC input and ADC pin at which it is sensed (Volts/Volts) | |
#define | FIN_MIN (40.0) |
min AC line frequency (Hertz) | |
#define | FIN_MAX (65.0) |
max AC line frequency (Hertz) | |
#define | UV_TRIG (8.0) |
Input under voltage trigger threshold (Volts) | |
#define | UV_HYS (2.0) |
Input under voltage hysteresis (Volts) | |
#define | OV_TRIG (80.0) |
Input over voltage trigger threshold (Volts) | |
#define | OV_HYS (2.0) |
Input over voltage hysteresis (Volts) | |
#define | ZC_TIMEOUT (2.0e-3) |
zero cross timeout (seconds) | |
#define | ZC_TMIN (100.0e-6) |
min zero cross time (seconds) | |
#define | AC_DROP_TIMEOUT (25.0e-3) |
AC drop timeout (seconds) | |
#define | DC_ACCEPTANCE_PERIOD_TICKS (rnd(FCALL_AC_MONITOR * 40.0e-3)) |
DC acceptance period in ticks. | |
#define | FIN_MIN_TICKS (rnd(FCALL_AC_MONITOR / FIN_MIN)) |
FIN_MIN (Hertz) converted to ticks for software timer. | |
#define | FIN_MAX_TICKS (rnd(FCALL_AC_MONITOR / FIN_MAX)) |
FIN_MAX (Hertz) converted to ticks for software timer. | |
#define | ZC_TIMEOUT_TICKS (rnd(FCALL_AC_MONITOR * ZC_TIMEOUT)) |
ZC_TIMEOUT (seconds) converted to ticks for software timer. | |
#define | ZC_TMIN_TICKS (rnd(FCALL_AC_MONITOR * ZC_TMIN)) |
ZC_TMIN (seconds) converted to ticks for software timer. | |
#define | AC_DROP_TIMEOUT_TICKS (rnd(FCALL_AC_MONITOR * AC_DROP_TIMEOUT)) |
AC_DROP_TIMEOUT (seconds) converted to ticks for software timer. | |
#define | UV_TRIG_ADC (rnd((UV_TRIG*AC_SENSE_GAIN)/3.3*4096)) |
UV_TRIG (UV trigger threshold) converted from Volts to ADC codes. | |
#define | UV_CLR_ADC (rnd(((UV_TRIG + UV_HYS)*AC_SENSE_GAIN)/3.3*4096)) |
UV clear threshold converted from Volts to ADC codes. | |
#define | OV_TRIG_ADC (rnd((OV_TRIG*AC_SENSE_GAIN)/3.3*4096)) |
OV_TRIG_ADC (OV trigger threshold) converted from Volts to ADC codes. | |
#define | OV_CLR_ADC (rnd(((OV_TRIG - OV_HYS)*AC_SENSE_GAIN)/3.3*4096)) |
OV clear threshold converted from Volts to ADC codes. | |
#define | HV_FLAG (0<<15) |
Used when sending status word from primary to secondary core. | |
#define | OPAMP_BIAS_IDEAL ((uint16_t)(1.65/3.3*4096)) |
#define | OPAMP_BIAS_HIGH_LIMIT ((uint16_t)(OPAMP_BIAS_IDEAL*1.05)) |
#define | OPAMP_BIAS_LOW_LIMIT ((uint16_t)(OPAMP_BIAS_IDEAL*0.95)) |
Functions | |
void | vacm_reset_phase_monitor_object (struct VACM_s *vacm_obj) |
void | vacm_state_machine (struct VACM_s *vacm_obj) |
void | vacm_reset_state_machine (struct VACM_s *vacm_obj) |
Variables | |
VACM_t | phase1 |
VACM_t | phase2 |
VACM_t | phase3 |
VAC Monitor Driver Header File
Definition in file vac_monitor.h.
#define max | ( | a, | |
b ) ((uint16_t)(((a)>(b)) ? (a):(b))) |
determines maximum value of 2 unsigned 16-bit integers.
Definition at line 69 of file vac_monitor.h.
#define min | ( | a, | |
b ) ((uint16_t)(((a)>(b)) ? (b):(a))) |
determines minimum value of 2 unsigned 16-bit integers.
Definition at line 60 of file vac_monitor.h.
#define OPAMP_BIAS_HIGH_LIMIT ((uint16_t)(OPAMP_BIAS_IDEAL*1.05)) |
Definition at line 316 of file vac_monitor.h.
#define OPAMP_BIAS_IDEAL ((uint16_t)(1.65/3.3*4096)) |
Definition at line 313 of file vac_monitor.h.
#define OPAMP_BIAS_LOW_LIMIT ((uint16_t)(OPAMP_BIAS_IDEAL*0.95)) |
Definition at line 317 of file vac_monitor.h.
#define rnd | ( | a | ) | ((uint16_t)((a)+((a)<0?-0.5:0.5))) |
rounds float to 16-bit unsigned integer.
Definition at line 51 of file vac_monitor.h.
void vacm_reset_phase_monitor_object | ( | struct VACM_s * | vacm_obj | ) |
void vacm_reset_state_machine | ( | struct VACM_s * | vacm_obj | ) |
void vacm_state_machine | ( | struct VACM_s * | vacm_obj | ) |
Definition at line 125 of file vac_monitor.c.
|
extern |
|
extern |
|
extern |