diff --git a/uc/Makefile b/uc/Makefile index 79913d3..07c21b3 100755 --- a/uc/Makefile +++ b/uc/Makefile @@ -86,13 +86,15 @@ F_CPU = 1000000 # make TYPE= xxxx SENSOR0=yyyy ... # TYPE = 2301 +METERCONST = 7091 +MUXN = 0 # SENSOR0 = 0123456789abcdef0123456789abcde0 SENSOR1 = 0123456789abcdef0123456789abcde1 SENSOR2 = 0123456789abcdef0123456789abcde2 SENSOR3 = 0123456789abcdef0123456789abcde3 # -CEXTRA = -D TYPE=$(TYPE) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"' +CEXTRA = -D TYPE=$(TYPE) -D METERCONST=$(METERCONST) -D MUXN=$(MUXN) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"' ##################################################################################### ##################################################################################### diff --git a/uc/main.h b/uc/main.h index 1d58be2..c478a08 100644 --- a/uc/main.h +++ b/uc/main.h @@ -40,36 +40,37 @@ #define TYPE 2301 #endif +#ifndef METERCONST + #if TYPE == 2201 // 220V - 1-phase @ 488.28Hz sampling rate + #define METERCONST 6783 + #define MUXN 0 + #warning "220V - 1-phase selected. METERCONST set to 6783" -#if TYPE == 2201 // 220V - 1-phase @ 488.28Hz sampling rate - #define METERCONST 6783 - #define MUXN 0 - #warning "220V - 1-phase selected. METERCONST set to 6783" + #elif TYPE == 2203 // 220V - 3-phase @ 488.28Hz sampling rate + #define METERCONST 6721 + #define MUXN 1 + #warning "220V - 3-phase selected. METERCONST set to 6721" -#elif TYPE == 2203 // 220V - 3-phase @ 488.28Hz sampling rate - #define METERCONST 6721 - #define MUXN 1 - #warning "220V - 3-phase selected. METERCONST set to 6721" + #elif TYPE == 2301 // 230V - 1-phase @ 488.28Hz sampling rate + #define METERCONST 7091 + #define MUXN 0 + #warning "230V - 1-phase selected. METERCONST set to 7091" -#elif TYPE == 2301 // 230V - 1-phase @ 488.28Hz sampling rate - #define METERCONST 7091 - #define MUXN 0 - #warning "230V - 1-phase selected. METERCONST set to 7091" + #elif TYPE == 2303 // 230V - 3-phase @ 488.28Hz sampling rate + #define METERCONST 7026 + #define MUXN 1 + #warning "230V - 3-phase selected. METERCONST set to 7026" -#elif TYPE == 2303 // 230V - 3-phase @ 488.28Hz sampling rate - #define METERCONST 7026 - #define MUXN 1 - #warning "230V - 3-phase selected. METERCONST set to 7026" + #elif TYPE == 2401 // 240V - 1-phase @ 488.28Hz sampling rate + #define METERCONST 7399 + #define MUXN 0 + #warning "240V - 1-phase selected. METERCONST set to 7399" -#elif TYPE == 2401 // 240V - 1-phase @ 488.28Hz sampling rate - #define METERCONST 7399 - #define MUXN 0 - #warning "240V - 1-phase selected. METERCONST set to 7399" - -#elif TYPE == 2403 // 240V - 3-phase @ 488.28Hz sampling rate - #define METERCONST 7331 - #define MUXN 1 - #warning "240V - 3-phase selected. METERCONST set to 7331" + #elif TYPE == 2403 // 240V - 3-phase @ 488.28Hz sampling rate + #define METERCONST 7331 + #define MUXN 1 + #warning "240V - 3-phase selected. METERCONST set to 7331" + #endif #endif #define START 0