update300714

Dependencies:   Buffer ConfigFile DS2482 mbed monitor timer0

Fork of 10_PT1000 by Sven Schäfer

Files at this revision

API Documentation at this revision

Comitter:
Sven3010
Date:
Wed Jul 30 15:04:59 2014 +0000
Parent:
2:f48d2eb0cc55
Commit message:
update300714

Changed in this revision

Buffer.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r f48d2eb0cc55 -r 72a65324d50d Buffer.lib
--- a/Buffer.lib	Mon Jul 28 14:37:14 2014 +0000
+++ b/Buffer.lib	Wed Jul 30 15:04:59 2014 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/users/sam_grove/code/Buffer/#d13a72146516
+https://mbed.org/users/sam_grove/code/Buffer/#cd0a1f4c623f
diff -r f48d2eb0cc55 -r 72a65324d50d SDFileSystem.lib
--- a/SDFileSystem.lib	Mon Jul 28 14:37:14 2014 +0000
+++ b/SDFileSystem.lib	Wed Jul 30 15:04:59 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Olivier/code/SDFileSystem/#96428c0b7119
+http://mbed.org/teams/Temp/code/SDFileSystem/#70db88aa21e3
diff -r f48d2eb0cc55 -r 72a65324d50d main.cpp
--- a/main.cpp	Mon Jul 28 14:37:14 2014 +0000
+++ b/main.cpp	Wed Jul 30 15:04:59 2014 +0000
@@ -15,6 +15,7 @@
 timer0 down_timer;                              // Zeitsteuerung
 Serial pc(USBTX, USBRX);                        // tx, rx
 Buffer <char> buf;                              // Ringbuffer für ankommende Zeichen
+PwmOut heizung(PTA13);
 
 //        sda, scl, adr
 DS2482 ow(PTE0,PTE1,0x30);
@@ -65,11 +66,13 @@
 16  PTD6,  ADC0_SE7b, 0}, k3.1
 */
 
-float temp1, temp_neu;
+float temp1, temp_mw;
 uint16_t temp_word;
 uint8_t n, y, status, ds1820_status;
 
-float temp_float;
+
+
+float temp_float, temp_diff, temp_alt, temp_neu;
 
 ConfigFile cfg;
 char value[BUFSIZ];
@@ -142,10 +145,15 @@
 int main() 
 {
     
+    heizung.period(0.020);          //  requires a 20ms period
+    heizung.pulsewidth(0.005);
+    temp_alt = 0.0;
+    
+    
     //------------------------------------------------------------------------------
     // RS232 Schnittstellt welche auf den CMSIS-DAP (USB Port) weitergeleitet wird
     //
-    pc.baud(9600);
+    pc.baud(115200);
     pc.attach(&rx_handler, Serial::RxIrq);
     pc.printf("\n V08 was compiled on %s  %s \n", __DATE__,__TIME__);
 
@@ -210,7 +218,7 @@
     //--------------------------------------------------------------------
     // Anfangswert bestimmen
     
-    temp_neu = read_mw(0);
+    temp_mw = read_mw(0);
     
     //pc.printf("\nPT1000; DS18B20");
     status = 0;
@@ -306,7 +314,7 @@
        
        if (down_timer.GetTimerStatus(2) == 0)
        {
-            down_timer.SetCountdownTimer(2,1,1000);
+            down_timer.SetCountdownTimer(2,1,500);
             
             //------------------------------------------------------
             // PT1000 lesen und berechnen und ausgeben
@@ -314,15 +322,41 @@
             //
            
             temp_word = read_mw(0);
-            temp_float = (temp_word - 17210);
-            temp_float /= 70;
-            // pc.printf("%0.2f; ",temp_float);                     // Rohdaten ausgeben
+            temp_float = (temp_word - 28500);
+            
+            //pc.printf("%d;",temp_word);
+            
+            temp_float /= 116;
+            pc.printf("%0.2f; ",temp_float);                     // Rohdaten ausgeben
 
+            temp_diff = 40 - temp_float;
+            
+            
+  
+            temp_neu = ((temp_diff*0.0005) + (temp_alt*0.9));
+            
+            if(temp_neu > 0.02){
+                temp_neu = 0.02;
+            }            
+            //if(temp_neu < -0.001){
+            //    temp_neu = -0.001;
+            //}
+            if(temp_float > 40){
+                temp_neu = 0.0;
+                }
+            
+            heizung.pulsewidth(0.0001 + temp_neu);
+            pc.printf("%0.4f;",temp_alt);
+            pc.printf("%0.4f \n",temp_neu);
+            
+            temp_alt = temp_neu;
 
             temp_word = read_mw(1);
             temp_float = (temp_word - 17210);
             temp_float /= 70;
             // pc.printf("%0.2f\n",temp_float);                      // Rohdaten ausgeben
+
+            
              
        
             //------------------------------------------------------
diff -r f48d2eb0cc55 -r 72a65324d50d mbed.bld
--- a/mbed.bld	Mon Jul 28 14:37:14 2014 +0000
+++ b/mbed.bld	Wed Jul 30 15:04:59 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/6213f644d804
\ No newline at end of file