diff --git a/uc/Makefile b/uc/Makefile index 7c5316f..639daa8 100755 --- a/uc/Makefile +++ b/uc/Makefile @@ -40,7 +40,7 @@ # # project specific settings: # -TARGET = main +TARGET = main # # Predefine the TYPE and SENSORx C macros in main.h via this Makefile. # Override the defaults on the command line by typing: @@ -56,7 +56,7 @@ SENSOR1 = 0123456789abcdef0123456789abcde1 SENSOR2 = 0123456789abcdef0123456789abcde2 SENSOR3 = 0123456789abcdef0123456789abcde3 # -CEXTRA = -D DBG=$(DBG) -D TYPE=$(TYPE) -D METERCONST=$(METERCONST) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"' +CEXTRA = -D DBG=$(DBG) -D METERCONST=$(METERCONST) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"' ############################################################################### @@ -259,7 +259,7 @@ bin/core.a: $(OBJ) # Target: clean project. clean: - $(REMOVE) bin/$(TARGET).hex bin/$(TARGET).eep bin/$(TARGET).cof bin/$(TARGET).elf \ + @$(REMOVE) bin/$(TARGET).hex bin/$(TARGET).eep bin/$(TARGET).cof bin/$(TARGET).elf \ bin/$(TARGET).map bin/$(TARGET).sym bin/$(TARGET).lss bin/$(TARGET).c bin/core.a \ $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d) diff --git a/uc/main.h b/uc/main.h index 10f7611..7eede99 100644 --- a/uc/main.h +++ b/uc/main.h @@ -27,129 +27,25 @@ # define SECOND 624 // 625Hz - 1 #ifndef SENSOR0 - #define SENSOR0 "0123456789abcdef0123456789abcde0" + #error "SENSOR0 not defined" #endif #ifndef SENSOR1 - #define SENSOR1 "0123456789abcdef0123456789abcde1" + #error "SENSOR1 not defined" #endif #ifndef SENSOR2 - #define SENSOR2 "0123456789abcdef0123456789abcde2" + #error "SENSOR2 not defined" #endif #ifndef SENSOR3 - #define SENSOR3 "0123456789abcdef0123456789abcde3" + #error "SENSOR3 not defined" #endif -#ifndef TYPE - #define TYPE 2300501 +#ifndef METERCONST + #error "METERCONST not defined" #endif -#ifndef METERCONST // @ 625Hz sampling rate - #if TYPE == 2200501 - #define METERCONST 5299 - #warning "220V - 50A - 1-phase selected. METERCONST set to 5299" - - #elif TYPE == 2200503 - #define METERCONST 5251 - #warning "220V - 50A - 3-phase selected. METERCONST set to 5251" - - #elif TYPE == 2300501 - #define METERCONST 5540 - #warning "230V - 50A - 1-phase selected. METERCONST set to 5540" - - #elif TYPE == 2300503 - #define METERCONST 5489 - #warning "230V - 50A - 3-phase selected. METERCONST set to 5489" - - #elif TYPE == 2400501 - #define METERCONST 5780 - #warning "240V - 50A - 1-phase selected. METERCONST set to 5780" - - #elif TYPE == 2400503 - #define METERCONST 5727 - #warning "240V - 50A - 3-phase selected. METERCONST set to 5727" - - - #elif TYPE == 2201001 - #define METERCONST 10598 - #warning "220V - 100A - 1-phase selected. METERCONST set to 10598" - - #elif TYPE == 2201003 - #define METERCONST 10502 - #warning "220V - 100A - 3-phase selected. METERCONST set to 10502" - - #elif TYPE == 2301001 - #define METERCONST 11080 - #warning "230V - 100A - 1-phase selected. METERCONST set to 11080" - - #elif TYPE == 2301003 - #define METERCONST 10978 - #warning "230V - 100A - 3-phase selected. METERCONST set to 10978" - - #elif TYPE == 2401001 - #define METERCONST 11560 - #warning "240V - 100A - 1-phase selected. METERCONST set to 11560" - - #elif TYPE == 2401003 - #define METERCONST 11454 - #warning "240V - 100A - 3-phase selected. METERCONST set to 11454" - - - #elif TYPE == 2202501 - #define METERCONST 26495 - #warning "220V - 250A - 1-phase selected. METERCONST set to 26495" - - #elif TYPE == 2202503 - #define METERCONST 26255 - #warning "220V - 250A - 3-phase selected. METERCONST set to 26255" - - #elif TYPE == 2302501 - #define METERCONST 27700 - #warning "230V - 250A - 1-phase selected. METERCONST set to 27700" - - #elif TYPE == 2302503 - #define METERCONST 27445 - #warning "230V - 250A - 3-phase selected. METERCONST set to 27445" - - #elif TYPE == 2402501 - #define METERCONST 28900 - #warning "240V - 250A - 1-phase selected. METERCONST set to 28900" - - #elif TYPE == 2402503 - #define METERCONST 28635 - #warning "240V - 250A - 3-phase selected. METERCONST set to 28635" - - - #elif TYPE == 2205001 - #define METERCONST 52990 - #warning "220V - 500A - 1-phase selected. METERCONST set to 52990" - - #elif TYPE == 2205003 - #define METERCONST 52510 - #warning "220V - 500A - 3-phase selected. METERCONST set to 52510" - - #elif TYPE == 2305001 - #define METERCONST 55400 - #warning "230V - 500A - 1-phase selected. METERCONST set to 55400" - - #elif TYPE == 2305003 - #define METERCONST 54890 - #warning "230V - 500A - 3-phase selected. METERCONST set to 54890" - - #elif TYPE == 2405001 - #define METERCONST 57800 - #warning "240V - 500A - 1-phase selected. METERCONST set to 57800" - - #elif TYPE == 2405003 - #define METERCONST 57270 - #warning "240V - 500A - 3-phase selected. METERCONST set to 57270" - #endif -#endif - -//#define POWERCONST (METERCONST*1758)/1000 // in mW - #define START 0 #define END3 0xffffffff #define END2 0xeeeeeeee