changed power to 16bit

added output of relais states
This commit is contained in:
Lucas Pleß 2013-06-14 15:02:48 +02:00
parent 15f63351c0
commit 3bf7ceee79
2 changed files with 5 additions and 2 deletions

View File

@ -45,7 +45,7 @@ void measure(void) {
current_out *= CURRENT_PER_TICK;
}
uint8_t get_power(uint16_t voltage, int16_t currents) {
uint16_t get_power(uint16_t voltage, int16_t currents) {
return (voltage/100 * (currents/100)) / 100 ;
}

View File

@ -10,6 +10,7 @@
#define DUMPSW PB2
#define PORT_SW PORTB
#define DDR_SW DDRB
#define PIN_SW PINB
#define LOAD_ON PORT_SW |= _BV(LOADSW)
#define LOAD_OFF PORT_SW &= ~_BV(LOADSW)
@ -18,7 +19,9 @@
#define DUMP_ON PORT_SW |= _BV(DUMPSW)
#define DUMP_OFF PORT_SW &= ~_BV(DUMPSW)
#define IS_LOAD_ON PIND &= _BV(LOADSW);
#define IS_LOAD_ON (PIN_SW & _BV(LOADSW))
#define IS_DUMP_ON (PIN_SW & _BV(DUMPSW))
#define IS_GEN_ON (PIN_SW & _BV(GENSW))
#define UNDERVOLTAGE 11200
#define OVERVOLTAGE1 14100