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: mbed
Fork of Low_Cost_PWM by
Diff: Main.cpp
- Revision:
- 3:77adbd7956b9
- Parent:
- 2:5798dde60822
diff -r 5798dde60822 -r 77adbd7956b9 Main.cpp
--- a/Main.cpp Wed Sep 10 11:57:57 2014 +0000
+++ b/Main.cpp Wed Sep 10 12:31:00 2014 +0000
@@ -113,7 +113,7 @@
//**************************DMS****************************************
- torque = DMS_Value * DMS_torque_factor; //Calculating torque
+ torque = DMS_Value * DMS_torque_factor; //Calculating torque
//**************************DMS****************************************
@@ -135,6 +135,50 @@
void read_sensors(void)
{
-
+ int Messwert_0 = 0, Messwert_1 = 0;
+
+ Mux_0 = 0, Mux_1 = 0;
+
+ //Selection of Multiplexer states
+
+ for (int i=0; i<=4; i++) {
+
+
+ Mux_0 = i&0x01;
+ Mux_1 = (i>>1)&0x01;
+ wait(0.00001);
+
+ Messwert_0 = Messkanal_0.read_u16();
+ Messwert_1 = Messkanal_1.read_u16();
+
+ switch(i) {
+ case 0: {
+ Temperatur_1 = Messwert_0 ;
+ Motorspannung = Messwert_1 * 0.000515 - 0.05 ; //Gute Näherung von 2- ~23V. Dannach zu niedrig.Z-Diode
+ break;
+ }
+
+ case 1: {
+ Temperatur_2 = Messwert_0 ;
+ Motorstrom = Messwert_1 * 0.000396 - 4.15;//
+ break;
+ }
+
+ case 2: {
+ Temperatur_3 = Messwert_0;
+ Bremsenspannung = Messwert_1 * 0.000515 - 0.05;//Gute Näherung von 2- ~23V. Dannach zu niedrig.Z-Diode
+ break;
+ }
+
+ case 3: {
+ Aux = Messwert_0 / 1629;
+ Bremsenstrom = Messwert_1; //* 0.00032 - 15.8;
+ break;
+ }
+
+
+ }
+
+ }
}
\ No newline at end of file
