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 18_PT1000 by
Revision 1:82c47e2d81f0, committed 2014-07-27
- Comitter:
- Sven3010
- Date:
- Sun Jul 27 08:38:11 2014 +0000
- Parent:
- 0:e248310dfcdb
- Child:
- 2:f48d2eb0cc55
- Commit message:
- Update
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jul 26 07:29:23 2014 +0000
+++ b/main.cpp Sun Jul 27 08:38:11 2014 +0000
@@ -10,7 +10,7 @@
#define CR 13
timer0 down_timer;
-Serial pc(PTC4, PTC3);
+Serial pc(USBTX, USBRX);
Buffer <char> buf;
monitor mon;
@@ -24,6 +24,7 @@
DigitalOut led1(LED1);
//DigitalOut LED2(PTA2);
DigitalOut LED5(PTA5);
+DigitalOut LED_4(PTA12);
// Schalter 4051
DigitalOut DC_A(PTE2);
@@ -66,6 +67,8 @@
uint16_t temp_word;
uint8_t n, y, status, ds1820_status;
+float temp_float;
+
//--------------------------------------------------------
// Interruptroutine wird bei jedem ankommenden Zeichen aufgerufen
void rx_handler(void)
@@ -89,6 +92,8 @@
int val = 0;
int mw = 0;
+ LED_4 = 0;
+
// 16 Messungen für eine bessere Mittelung durchführen
for (n = 0; n < 16; n++)
@@ -110,6 +115,9 @@
// Wert durch 16 teilen
mw = mw >> 4;
+
+ LED_4 = 1;
+
return mw;
}
@@ -117,9 +125,9 @@
int main()
{
- pc.baud(56700);
+ pc.baud(9600);
pc.attach(&rx_handler, Serial::RxIrq);
- // pc.printf("\n V08 was compiled on %s %s \n", __DATE__,__TIME__);
+ pc.printf("\n V08 was compiled on %s %s \n", __DATE__,__TIME__);
down_timer.SetCountdownTimer(0,1,50); // Timer für die LED
down_timer.SetCountdownTimer(1,1,500); // Timer für den one wire bus
@@ -188,7 +196,7 @@
//-------------------------------------------
// timer 1 steuert den one wire bus
-
+ /*
if (down_timer.GetTimerStatus(1) == 0)
{
switch (ds1820_status)
@@ -249,7 +257,7 @@
} // end switch
} // if (down_timer
-
+ */
//-------------------------------------------
// timer 2 steuert die Datenausgabe
@@ -263,21 +271,20 @@
//
temp_word = read_mw(0);
- pc.printf("#0 %d\n",temp_word); // Rohdaten ausgeben
+ temp_float = (temp_word - 17210);
+ temp_float /= 70;
+ pc.printf("%0.2f; ",temp_float); // Rohdaten ausgeben
+
temp_word = read_mw(1);
- pc.printf("#1 %d\n",temp_word); // Rohdaten ausgeben
-
- temp_word = read_mw(2);
- pc.printf("#2 %d\n",temp_word); // Rohdaten ausgeben
-
- temp_word = read_mw(3);
- pc.printf("#3 %d\n",temp_word); // Rohdaten ausgeben
-
+ temp_float = (temp_word - 17210);
+ temp_float /= 70;
+ pc.printf("%0.2f\n",temp_float); // Rohdaten ausgeben
+
//------------------------------------------------------
// one wire Daten lesen und ausgeben
-
+ /*
for (n = 0; n < OW_MAX_DEVICES; n++) // Ausgabe der Daten
{
if ((ow.ow.device_table[n].status & 0x0f) == 3) // Daten wurden gelesen
@@ -288,7 +295,7 @@
}
down_timer.SetCountdownTimer(1,1,10); // Messung neu starten
-
+ */
} // end if(down_timer ...
} // end while
