TVZ test

Dependencies:   mbed

Revision:
5:77ff08b129c0
Parent:
4:4620184bbb1f
Child:
6:be9abe81bbd1
--- a/main.cpp	Fri Feb 07 12:12:33 2014 +0000
+++ b/main.cpp	Thu Feb 13 16:07:56 2014 +0000
@@ -21,6 +21,7 @@
 int valueSensA, valueSensB, valueSensC, valueSensD;
 float fAzimuthErr;
 float fElevationErr;
+float fSensACalib;
 unsigned char *pointnavar;
 
 int main()
@@ -30,6 +31,7 @@
     switch_ip2.mode(PullUp);
     switch_ip3.mode(PullUp);
     switch_ip4.mode(PullUp);
+    fSensACalib= 35.77;
 
     //accept default format, of 8 bits, no parity
     while (1) {
@@ -113,12 +115,25 @@
                 pc.printf("AZIMUT:  %+3.0f  ELEVATION; %+3.0f  \n\r",   fAzimuthErr, fElevationErr);
             }
         } // if (switch_ip1==0)
-        
+
         else {
-            header_read=0x20;                 // write output pattern
+            header_read=0x20;                 //   write output pattern
+            Outbuff[0] = header_read;
             param_ads = 2;      // parameter to write
-            
-            
-            } // else
+            Outbuff[1] = param_ads;
+            pointnavar = (unsigned char*) &fSensACalib;
+            for (int i=2; i<6; i++) {
+                Outbuff[i] = *pointnavar ;
+                pointnavar++;
+            }
+            Outbuff[6]= 5;  // checksum
+
+            for (int i=0; i<7; i++) {
+                while (async_port.writeable()==0);  //is there a place to write?
+                async_port.putc(Outbuff[i]);       //transmit byte
+            }
+
+
+        } // else
     }  // while(1)
 }  //main