KEIS

Dependencies:   C12832_lcd mbed

Files at this revision

API Documentation at this revision

Comitter:
khayakawa
Date:
Wed Oct 02 03:53:32 2013 +0000
Commit message:
KEIS

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r acb42df924ce C12832_lcd.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Wed Oct 02 03:53:32 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
diff -r 000000000000 -r acb42df924ce main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 02 03:53:32 2013 +0000
@@ -0,0 +1,85 @@
+/* PC=router divce, mbed=cordinator */
+/* */
+/* */ 
+
+#include "mbed.h"
+#include "C12832_lcd.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+Serial device(p9, p10);  // tx, rx
+C12832_LCD lcd;
+DigitalOut myled(LED1);
+DigitalIn fire(p14);
+int pkt_phase=0;
+int pkt_count=0;
+char* ch[16]={"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"};
+char v_val[2];
+int num_Xbee=0;
+
+void dev_rx () {
+    char val;
+    int tmp1,tmp2;
+        
+    myled=1;
+    val=device.getc();
+    pkt_count++;
+    if(pkt_phase==0 && val==0x7E){
+        pkt_phase=1;
+        pkt_count=1;
+    }
+    
+    if(pkt_phase==1 && pkt_count==4){
+        if( val==0x92 ){
+            pkt_phase=2;
+        }else{
+            pkt_count=0;
+            pkt_phase=0;
+        }
+    }
+    
+    if(pkt_phase==2 && pkt_count==12){
+        if( val==0x77){
+            pkt_phase=3;
+        }else{
+            pkt_count=0;
+            pkt_phase=0;
+        }
+    }
+    
+    if(pkt_phase==3 && pkt_count==22){
+        pkt_phase=4;
+        v_val[0]=val;
+    }
+    
+    if(pkt_phase==4 && pkt_count==23){
+        pkt_phase=0;
+        pkt_count=0;
+        v_val[1]=val;
+        lcd.locate(0,3);
+        lcd.printf("v_val1:%x%x ",v_val[0],v_val[1]);
+    }
+    
+    
+    tmp1 = val/16;
+    tmp2 = val%16;
+    pc.printf("%s%s",ch[tmp1],ch[tmp2]);
+    //wait(.2);
+    myled=0;
+    
+    
+}
+
+int main() {
+
+    lcd.cls();
+    lcd.locate(0,0);
+    myled=0;
+    
+  //  int sd_data_on[20]={0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x92,0xFF,0x77,0xFF,0xFE,0x02,0x44,0x32,0x05,0x70};
+  //  int sd_data_off[20]={0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x92,0xFF,0x77,0xFF,0xFE,0x02,0x44,0x32,0x04,0x71};
+    
+    device.attach(&dev_rx, Serial::RxIrq);
+    
+
+    
+}
diff -r 000000000000 -r acb42df924ce mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 02 03:53:32 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file