diff --git a/.gitignore b/.gitignore index 1775dbf..6027263 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Prerequisites *.d +gnuplotscript.gp # Compiled Object files *.slo diff --git a/control/examples/pegel/gnuplotscript.gp b/control/examples/pegel/gnuplotscript.gp deleted file mode 100644 index 54829e1..0000000 --- a/control/examples/pegel/gnuplotscript.gp +++ /dev/null @@ -1,13 +0,0 @@ -set margin 10,10 -unset key -set grid -set title '' -set xlabel 'U_{OUT} [V]' -set ylabel 'U_{IN} [V]' -set xrange [0:5] -set yrange [0:5] -set label at 5,5 ' [V] = 0' left -unset output -set terminal qt -unset output -plot "/tmp/tempfile0" using ($1*0.004888):($2*0.004888) binary format="%int16%int16" endian=big title ' [V] = 0' w l diff --git a/control/examples/pegel/main.cpp b/control/examples/pegel/main.cpp index 4a98e19..4370320 100644 --- a/control/examples/pegel/main.cpp +++ b/control/examples/pegel/main.cpp @@ -34,7 +34,10 @@ int main() for(uint16_t x = 0; x < sample_count * delta; x += delta) { - pf.addDot(Dot(x, ba[x], curve)); + drv.analogWrite0(x); + uint16_t y = drv.analogRead(0); + std::cout << x << " - " << y << std::endl; + pf.addDot(Dot(x, y, curve)); } // speichern und plotty starten diff --git a/control/examples/pegel/test_plot b/control/examples/pegel/test_plot index d6217fd..908f0cb 100644 Binary files a/control/examples/pegel/test_plot and b/control/examples/pegel/test_plot differ diff --git a/control/src/Makefile b/control/src/Makefile index c5438a4..cb2b18a 100644 --- a/control/src/Makefile +++ b/control/src/Makefile @@ -47,7 +47,7 @@ cli: drv $(OBJECTS_CLI) $(PATH_COMPILER) $(CFLAGS) $(OBJECTS_CLI) -L $(PATH_TMP_LIB) -o $(OUT_TMP_CLI) $(LDFLAGS_CLI) @bash -c 'if [ ! -f "$(OUT_DRV)" ]; then echo -e "\n*** Warning ***: driver not installed\nType \"sudo make install\" to install or update b15fdrv."; fi' -install: drv +install: all @echo "Installing driver..." @mkdir -p $(PATH_INCLUDE) cp $(OUT_TMP_DRV) $(OUT_DRV) @@ -55,7 +55,7 @@ install: drv cp $(OUT_TMP_PLOTTY) $(OUT_PLOTTY) cp drv/*.h $(PATH_INCLUDE) -uninstall: +uninstall: clean @echo "Uninstalling driver..." rm -rf $(PATH_INCLUDE) $(OUT_DRV) $(OUT_CLI) $(OUT_PLOTTY) diff --git a/firmware/Makefile b/firmware/Makefile index 7805486..15d169e 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -44,7 +44,7 @@ clean: checkfuses: @echo "Checking fuses..." - @bash -c 'diff -B <( echo "$(FUSES)" ) <( avrdude -Pusb -p $(MCU) -c $(PROGRAMMER) 2>&1 | grep "safemode: Fuses OK" | tail -c 19 ) >/dev/null || avrdude -Pusb -p $(MCU) -c $(PROGRAMMER) -U lfuse:w:0x$(LFUSE):m -U hfuse:w:0x$(HFUSE):m -U efuse:w:0x$(EFUSE):m' + @bash -c 'diff -B <( echo "$(FUSES)" ) <( avrdude -Pusb -p $(MCU) -c $(PROGRAMMER) 2>&1 | grep "safemode: Fuses OK" | tail -c 19 ) >/dev/null && echo "Fuses okay" || avrdude -Pusb -p $(MCU) -c $(PROGRAMMER) -U lfuse:w:0x$(LFUSE):m -U hfuse:w:0x$(HFUSE):m -U efuse:w:0x$(EFUSE):m' upload: b15f checkfuses @echo "Uploading hex file..." diff --git a/firmware/adu.cpp b/firmware/adu.cpp index 3e7faff..af2abca 100644 --- a/firmware/adu.cpp +++ b/firmware/adu.cpp @@ -3,7 +3,7 @@ void ADU::init() volatile { // externe Referenz an AREF - ADMUX = 0; + ADMUX = _BV(REFS0); // ADC aktiviert, Interruptbetrieb, prescaler = 128 ADCSRA = _BV(ADEN) | _BV(ADIE) | _BV(ADPS2) | _BV(ADPS1) | _BV(ADPS0);