uc: add support for sensor board v1.2 dual ADC inputs and South-African voltages

This commit is contained in:
Bart Van Der Meerssche 2010-01-05 13:51:09 +00:00
parent 251514da22
commit bc2bebfdcd
2 changed files with 19 additions and 3 deletions

View File

@ -198,7 +198,8 @@ void setup()
// select VBG as reference for ADC
ADMUX |= (1<<REFS1) | (1<<REFS0);
// ADC0 selected by default
// ADCn selected via main.h
ADMUX |= MUXN;
// ADC prescaler set to 8 => 1000kHz / 8 = 125kHz (DS p.258)
ADCSRA |= (1<<ADPS1) | (1<<ADPS0);
@ -244,7 +245,7 @@ void loop()
if (aux[i].pulse == true) {
if (i == 0) {
//debugging
printString("msg ADC0 sample value: ");
printString("msg ADC sample value: ");
printIntegerInBase((unsigned long)aux[0].debug, 10);
printString("\n");
}

View File

@ -1,6 +1,7 @@
//
// main.h : AVR uC header file for flukso sensor board
// Copyright (c) 2008-2009 jokamajo.org
// Copyright (c) 2010 flukso.net
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -26,20 +27,34 @@
#define TYPE 2301
#if TYPE == 2301 // 230V - 1-phase @ 488.28Hz sampling rate
#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 == 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 == 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"
#endif