Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP MODSERIAL mbed monitor timer0
Fork of 17_PT1000 by
Revision 2:f48d2eb0cc55, committed 2014-07-28
- Comitter:
- rs27
- Date:
- Mon Jul 28 14:37:14 2014 +0000
- Parent:
- 1:82c47e2d81f0
- Child:
- 3:72a65324d50d
- Commit message:
- rev 10
;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ConfigFile.lib Mon Jul 28 14:37:14 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/shintamainjp/code/ConfigFile/#f6ceafabe9f8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Mon Jul 28 14:37:14 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Olivier/code/SDFileSystem/#96428c0b7119
--- a/main.cpp Sun Jul 27 08:38:11 2014 +0000
+++ b/main.cpp Mon Jul 28 14:37:14 2014 +0000
@@ -1,7 +1,9 @@
-// Version 07 30.06.2013
+// Version 10 27.07.2014
// die Ausgabe auf das Format #nr val umgestellt
#include "mbed.h"
+#include "ConfigFile.h"
+#include "SDFileSystem.h"
#include "DS2482.h"
#include "timer0.h"
#include "Buffer.h"
@@ -9,10 +11,10 @@
#define CR 13
-timer0 down_timer;
-Serial pc(USBTX, USBRX);
-Buffer <char> buf;
-monitor mon;
+SDFileSystem sd(PTD2, PTD3, PTC5, PTD0, "sd"); // The pinout (MOSI, MISO, SCLK, CS)
+timer0 down_timer; // Zeitsteuerung
+Serial pc(USBTX, USBRX); // tx, rx
+Buffer <char> buf; // Ringbuffer für ankommende Zeichen
// sda, scl, adr
DS2482 ow(PTE0,PTE1,0x30);
@@ -69,7 +71,14 @@
float temp_float;
-//--------------------------------------------------------
+ConfigFile cfg;
+char value[BUFSIZ];
+
+//------------------------------------------------------------------------------
+// Werte die auch über das config file gesetzt werden können
+float offset = 0.0;
+
+//------------------------------------------------------------------------------
// Interruptroutine wird bei jedem ankommenden Zeichen aufgerufen
void rx_handler(void)
{
@@ -84,7 +93,13 @@
}
}
-
+//------------------------------------------------------------------------------
+// lesen der PT1000 AD-Werte
+//
+// Um Störungen zu reduzieren werden 16 Werte gelesen und daraus wird der
+// Mittelwert berechnet. Eine Messung dauert ca. 30µs. Somit wird für eine Messung
+// ca. eine Zeit von 0,5ms benötigt.
+//
int read_mw(uint8_t pos)
{
uint8_t n;
@@ -121,22 +136,45 @@
return mw;
}
+//------------------------------------------------------------------------------
+//
int main()
{
+ //------------------------------------------------------------------------------
+ // RS232 Schnittstellt welche auf den CMSIS-DAP (USB Port) weitergeleitet wird
+ //
pc.baud(9600);
pc.attach(&rx_handler, Serial::RxIrq);
pc.printf("\n V08 was compiled on %s %s \n", __DATE__,__TIME__);
+ mon_init();
+
+ //------------------------------------------------------------------------------
+ // Timer für die Zeitsteuerung
+ //
down_timer.SetCountdownTimer(0,1,50); // Timer für die LED
down_timer.SetCountdownTimer(1,1,500); // Timer für den one wire bus
down_timer.SetCountdownTimer(2,1,1000);// Timer für die Ausgabe der Daten
r = g = b = 1; // RGB LED ausschalten
+
+ //--------------------------------------------------------------------
+ // Variablen von der SD Karte initialisieren
+
+ cfg.read("/sd/input.cfg");
+
+ if (cfg.getValue("offset", &value[0], sizeof(value)))
+ {
+ offset = atof(value);
+ pc.printf("\noffset = %f", offset);
+ }
+
//--------------------------------------------------------------------
// one wire bus
+ /*
// pc.printf("\n ++++ on wire search ++++\n");
wait (0.1);
ow.DS18XX_Read_Address();
@@ -178,12 +216,17 @@
status = 0;
ds1820_status = 0;
+ */
+
//--------------------------------------------------------------------
// Schleife fuer die Datenerfassung
while(1)
{
- mon.get_line();
+ //-------------------------------------------
+ // Prüfen ob Zeichen eingegeben wurden
+
+ get_line();
//-------------------------------------------
// timer 0 steuert die LED
@@ -273,13 +316,13 @@
temp_word = read_mw(0);
temp_float = (temp_word - 17210);
temp_float /= 70;
- pc.printf("%0.2f; ",temp_float); // Rohdaten ausgeben
+ // pc.printf("%0.2f; ",temp_float); // Rohdaten ausgeben
temp_word = read_mw(1);
temp_float = (temp_word - 17210);
temp_float /= 70;
- pc.printf("%0.2f\n",temp_float); // Rohdaten ausgeben
+ // pc.printf("%0.2f\n",temp_float); // Rohdaten ausgeben
//------------------------------------------------------
--- a/monitor.lib Sun Jul 27 08:38:11 2014 +0000 +++ b/monitor.lib Mon Jul 28 14:37:14 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/rs27/code/monitor/#f0fbbfdca478 +http://mbed.org/users/rs27/code/monitor/#19313470f629
