From 3bf7ceee798d509f732e48f0a74a4d5841f3419c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Fri, 14 Jun 2013 15:02:48 +0200 Subject: [PATCH] changed power to 16bit added output of relais states --- display/software/powerboard/src/main.c | 2 +- display/software/powerboard/src/main.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/display/software/powerboard/src/main.c b/display/software/powerboard/src/main.c index 351992e..baf5298 100644 --- a/display/software/powerboard/src/main.c +++ b/display/software/powerboard/src/main.c @@ -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 ; } diff --git a/display/software/powerboard/src/main.h b/display/software/powerboard/src/main.h index 1a5f3ec..c1eba92 100644 --- a/display/software/powerboard/src/main.h +++ b/display/software/powerboard/src/main.h @@ -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