uc: add support for US split-phase supplies

This commit is contained in:
Bart Van Der Meerssche 2010-04-09 21:20:22 +00:00
parent cbd4283d18
commit 9f054b1205
3 changed files with 11 additions and 3 deletions

View File

@ -44,11 +44,12 @@ TARGET = main
#
# Predefine the TYPE and SENSORx C macros in main.h via this Makefile.
# Override the defaults on the command line by typing:
# make TYPE=xxxx SENSOR0=yyyy ...
# make PHASE=x METERCONST=y SENSOR0=z ...
#
DBG = 0
#
TYPE = 2300501
PHASE = 1
METERCONST= 5508
#
SENSOR0 = 0123456789abcdef0123456789abcde0
@ -56,7 +57,7 @@ SENSOR1 = 0123456789abcdef0123456789abcde1
SENSOR2 = 0123456789abcdef0123456789abcde2
SENSOR3 = 0123456789abcdef0123456789abcde3
#
CEXTRA = -D DBG=$(DBG) -D METERCONST=$(METERCONST) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"'
CEXTRA = -D DBG=$(DBG) -D PHASE=$(PHASE) -D METERCONST=$(METERCONST) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"'
###############################################################################

View File

@ -79,8 +79,11 @@ ISR(TIMER2_COMPA_vect) {
#endif
// read ADC result
// add to nano(Wh) counter
#if PHASE == 2
MacU16X16to32(aux[0].nano, METERCONST, ADC);
#else
MacU16X16to32(aux[muxn].nano, METERCONST, ADC);
#endif
if (aux[muxn].nano > WATT) {
measurements[muxn].value++;
aux[muxn].pulse = true;

View File

@ -42,6 +42,10 @@
#error "SENSOR3 not defined"
#endif
#ifndef PHASE
#error "PHASE not defined"
#endif
#ifndef METERCONST
#error "METERCONST not defined"
#endif