Update vom 10.05.15
Dependencies: FreescaleIAP MODSERIAL mbed monitor timer0
Fork of 18_PT1000 by
Diff: main.cpp
- Revision:
- 7:c1602e28a906
- Parent:
- 6:f53dd76c8806
- Child:
- 8:3564645d2213
--- a/main.cpp Sun Aug 03 08:12:55 2014 +0000 +++ b/main.cpp Sun Aug 03 18:25:06 2014 +0000 @@ -5,7 +5,7 @@ #include "mbed.h" #include "ConfigFile.h" #include "SDFileSystem.h" -#include "DS2482.h" +//#include "DS2482.h" #include "timer0.h" #include "Buffer.h" #include "monitor.h" @@ -91,6 +91,7 @@ uint8_t n, y, status, ds1820_status; int tropfen_anz = 0; +bool send_flag = true; float temp_float, temp_diff, temp_neu, esum, temp_soll; @@ -252,7 +253,7 @@ if (cfg.getValue("soll", &value[0], sizeof(value))) { soll_wert = atof(value); - pc.printf("\nsoll_wert = %f", offset); + pc.printf("\nsoll_wert = %f\n", soll_wert); } //-------------------------------------------------------------------- @@ -274,10 +275,13 @@ //------------------------------------------- // Prüfen ob Tropfenzahl erreicht + if (tropfen_anz >= drops){ // mit einer 9 die Tropfen sperren - com.putc('9'); + if(send_flag){ com.putc('9'); + send_flag = false; + } } //------------------------------------------- @@ -294,12 +298,14 @@ if (down_timer.GetTimerStatus(1) == 0) { - down_timer.SetCountdownTimer(0,1,1000); + down_timer.SetCountdownTimer(1,1,1000); tropfen_anz = 0; // mit einer 1 die Tropfen freigeben - if (f_flag) com.putc('1'); + if (f_flag){ com.putc('1'); + send_flag=true; + } } //------------------------------------------- @@ -319,7 +325,7 @@ temp_soll /= GAIN; //pc.printf("%d;",temp_word); // Rohwert ausgeben - pc.printf("Soll %2.2f;",temp_soll); // Temperaturwert soll Flüssigkeit + pc.printf("Soll %2.2f; Soll ist %2.2f; ",soll_wert, temp_soll); // Temperaturwert soll Flüssigkeit //------------------------------------------------------ // PT1000 Kanal 0 ( Fühler am Heizwiderstand ) lesen und die Temperatur berechnen @@ -385,15 +391,19 @@ { heizung.pulsewidth(0.0001 + temp_neu); //pc.printf("%0.4f;",temp_alt); - pc.printf("%0.4f \n",temp_neu); } else { heizung.pulsewidth(0.000000); } - + pc.printf("%0.4f; ",temp_neu); + if(t_flag) + pc.printf("on"); + else + pc.printf("off"); + pc.printf("\n"); } // end if(down_timer ... - + } // end while }