Seth Ruiter / Mbed 2 deprecated bouke

Dependencies:   MODSERIAL SDFileSystemSeth mbed

Fork of Opstellingbachelor_opdracht by Claudia Haarman

Files at this revision

API Documentation at this revision

Comitter:
sdruiter
Date:
Fri Sep 07 13:35:25 2018 +0000
Parent:
10:96c194005985
Commit message:
bouke versie

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon May 28 06:42:16 2018 +0000
+++ b/main.cpp	Fri Sep 07 13:35:25 2018 +0000
@@ -12,8 +12,8 @@
 DigitalOut CS_1(PTE25);        // chip select pin of thermocouples
 
 
-//DigitalIn pins[12]={D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13};        //thermocouples 1 - 12 select corresponding pin numbers mbed
-DigitalIn pins[7]={D2, D3, D4, D5, D6, D7, D10};        //thermocouple select corresponding pin numbers mbed
+DigitalIn pins[13]={D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13};        //thermocouples 1 - 12 select corresponding pin numbers mbed
+//DigitalIn pins[9]={D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13};        //thermocouple select corresponding pin numbers mbed
 
 
 // Torque sensor
@@ -34,7 +34,7 @@
 Ticker tick;
 
 const int baudrate = 115200;      // baud rate
-const float Ts = 0.25;            // sample time (sec)
+const float Ts = 30;            // sample time (sec)
 
 const int led_on = 0;
 const int led_off = 1;
@@ -76,7 +76,7 @@
     
     
     float d = 0;
-    int16_t b[3] = {0,0,0};
+    int16_t b[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
 
     CS_1 = 0;       //Active-Low Chip Select. Set CS low to enable the serial interface.
     wait_us(0.2);
@@ -86,7 +86,7 @@
         wait_us(0.1);                   //wait for 100ns
         SCK_1 = 1;                      //then set clock high again
         wait_us(0.1);                   //wait for 100ns
-        for (int j = 0; j < 3; j++) {   //read out bits for each thermocouple (0 to 11)
+        for (int j = 0; j < 11; j++) {   //read out bits for each thermocouple (0 to 11)
             if (pins[j]) {
                 b[j] |= (1 << i);       //bitshift
             }
@@ -95,7 +95,7 @@
     
     CS_1 = 1;
     
-    for (int j = 0; j < 3; j++) {       //for every thermocouple (starting from 0 to 11, so 12 in total)
+    for (int j = 0; j < 11; j++) {       //for every thermocouple (starting from 0 to 11, so 12 in total)
         if (b[j] & 0x1) {               //b[j] contains the bits that are received from every chip. if least significant bit is 1, then open circuit.
             b[j] = 20000;
         } else {
@@ -114,7 +114,7 @@
 void getsample(bool meas)
 {
     if(meas){                                   // alleen data uitlezen en opslaan als meas = 1
-        read_TC = readTC();                     // call function to read thermocouple data  
+        readTC();                     // call function to read thermocouple data  
     }
     return;
 }