REVO_1_SteeringDisplay

Dependencies:   Digital_InOut KS0108 mbed

Files at this revision

API Documentation at this revision

Comitter:
kiran_mbed
Date:
Sat Sep 27 18:43:15 2014 +0000
Commit message:
Steering_Display;

Changed in this revision

Digital_InOut.lib Show annotated file Show diff for this revision Revisions of this file
Digital_Out.h Show annotated file Show diff for this revision Revisions of this file
KS0108.lib Show annotated file Show diff for this revision Revisions of this file
Steering.cpp Show annotated file Show diff for this revision Revisions of this file
Steering.h Show annotated file Show diff for this revision Revisions of this file
SteeringTemp.h 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Digital_InOut.lib	Sat Sep 27 18:43:15 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/kiran_mbed/code/Digital_InOut/#b4bc3430a055
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Digital_Out.h	Sat Sep 27 18:43:15 2014 +0000
@@ -0,0 +1,315 @@
+/*
+Test Code
+#include "Digital_Out.h"
+
+//Serial pc(USBTX,USBRX);
+
+int main()
+{
+    Digital_Out ledPin1(p1_18,1);
+    Digital_Out ledPin2(p1_20,0);
+    Digital_Out ledPin3(p1_21,1);
+    Digital_Out ledPin4(p1_23,0);
+     
+    
+    wait(0.5);
+    while(1)
+    {
+        ledPin1= !ledPin1;
+        ledPin2= !ledPin2;
+        ledPin3= !ledPin3;
+        ledPin4= !ledPin4;
+         
+        wait(0.5);
+        ledPin1= !ledPin1;
+        ledPin2= !ledPin2;
+        ledPin3= !ledPin3;
+        ledPin4= !ledPin4;
+        
+        wait(0.5);
+    }
+
+Digital_Out pin(p0_0);
+
+DigitalOut myled(LED1);
+
+Timer t;
+int main() {
+   t.reset();
+   t.start();
+   for (int i = 0; i < 1000000; i++){
+    pin = 1;
+    pin = 0;
+   }
+       t.stop();
+
+   unsigned int time1 = t.read_us(); 
+    
+    t.reset();
+    t.start();
+    for (int i = 0; i < 1000000; i++) {
+    myled = 1;
+    myled = 0;
+    }
+    t.stop();
+    unsigned int time2 = t.read_us();
+    printf("Library time: %d, mbed time: %d\r\n", time1, time2);
+    while(1) {
+
+    }
+}
+*/
+
+#ifndef DIGITAL_OUT_H
+    #define DIGITAL_OUT_H
+    
+    #include"mbed.h"
+        
+    #define _PINSEL_BASE 0x4002C000
+    #define _FIODIR_BASE 0x2009C000
+    #define _FIOSET_BASE 0x2009C018
+    #define _FIOCLR_BASE 0x2009C01C
+    #define _FIOPIN_BASE 0x2009C014
+    
+    #ifndef _PIN_
+        #define _PIN_
+        typedef struct
+        {
+            int port;
+            int pin;
+        }Pin;
+    #endif /* _PIN_ */
+    
+    #ifndef _PIN_NAME_
+        #define _PIN_NAME_
+        // Note many pins are not available as fully functional GPIOs, they are ommitted below
+        enum Pin_Name
+        {
+            p0_0 = 0,
+            p0_1 = 1,
+            p0_2 = 2,
+            p0_3 = 3,
+            p0_4 = 4,
+            p0_5 = 5,
+            p0_6 = 6,
+            p0_7 = 7,
+            p0_8 = 8,
+            p0_9 = 9,
+            p0_10 = 10,
+            p0_11 = 11,
+            /*p0_12 = 12,
+            p0_13 = 13,
+            p0_14 = 14,*/
+            p0_15 = 15,
+            p0_16 = 16,
+        
+            p0_17 = 17,
+            p0_18 = 18,
+            p0_19 = 19,
+            p0_20 = 20,
+            p0_21 = 21,
+            p0_22 = 22,
+            p0_23 = 23,
+            p0_24 = 24,
+            p0_25 = 25,
+            p0_26 = 26,
+          /*  p0_27 = 27,
+            p0_28 = 28,
+            p0_29 = 29,
+            p0_30 = 30,*/
+        
+        
+            p1_0 = 100,
+            p1_1 = 101,
+           /* p1_2 = 102,
+            p1_3 = 103,*/
+            p1_4 = 104,
+           /* p1_5 = 105,
+            p1_6 = 106,
+            p1_7 = 107,*/
+            p1_8 = 108,
+            p1_9 = 109,
+            p1_10 = 110,
+           /* p1_11 = 111,
+            p1_12 = 112,
+            p1_13 = 113,*/
+            p1_14 = 114,
+            p1_15 = 115,
+        
+            p1_16 = 116,
+            p1_17 = 117,
+            p1_18 = 118,
+            p1_19 = 119,
+            p1_20 = 120,
+            p1_21 = 121,
+            p1_22 = 122,
+            p1_23 = 123,
+            p1_24 = 124,
+            p1_25 = 125,
+            p1_26 = 126,
+            p1_27 = 127,
+            p1_28 = 128,
+            p1_29 = 129,
+            p1_30 = 130,
+        
+        
+            p2_0 = 200,
+            p2_1 = 201,
+            p2_2 = 202,
+            p2_3 = 203,
+            p2_4 = 204,
+            p2_5 = 205,
+            p2_6 = 206,
+            p2_7 = 207,
+            p2_8 = 208,
+            p2_9 = 209,
+            p2_10 = 210,
+            p2_11 = 211,
+            p2_12 = 212,
+            p2_13 = 213,
+           /* p2_14 = 214,
+            p2_15 = 215,
+        
+            p2_16 = 216,
+            p2_17 = 217,
+            p2_18 = 218,
+            p2_19 = 219,
+            p2_20 = 220,
+            p2_21 = 221,
+            p2_22 = 222,
+            p2_23 = 223,
+            p2_24 = 224,
+            p2_25 = 225,
+            p2_26 = 226,
+            p2_27 = 227,
+            p2_28 = 228,
+            p2_29 = 229,
+            p2_30 = 230,*/
+        
+        
+           /* p3_0 = 300,
+            p3_1 = 301,
+            p3_2 = 302,
+            p3_3 = 303,
+            p3_4 = 304,
+            p3_5 = 305,
+            p3_6 = 306,
+            p3_7 = 307,
+            p3_8 = 308,
+            p3_9 = 309,
+            p3_10 = 310,
+            p3_11 = 311,
+            p3_12 = 312,
+            p3_13 = 313,
+            p3_14 = 314,
+            p3_15 = 315,
+        
+            p3_16 = 316,
+            p3_17 = 317,
+            p3_18 = 318,
+            p3_19 = 319,
+            p3_20 = 320,
+            p3_21 = 321,
+            p3_22 = 322,
+            p3_23 = 323,
+            p3_24 = 324,*/
+            p3_25 = 325,
+            p3_26 = 326,
+            /*p3_27 = 327,
+            p3_28 = 328,
+            p3_29 = 329,
+            p3_30 = 330,*/
+        
+            /*p4_0 = 400,
+            p4_1 = 401,
+            p4_2 = 402,
+            p4_3 = 403,
+            p4_4 = 404,
+            p4_5 = 405,
+            p4_6 = 406,
+            p4_7 = 407,
+            p4_8 = 408,
+            p4_9 = 409,
+            p4_10 = 410,
+            p4_11 = 411,
+            p4_12 = 412,
+            p4_13 = 413,
+            p4_14 = 414,
+            p4_15 = 415,
+        
+            p4_16 = 416,
+            p4_17 = 417,
+            p4_18 = 418,
+            p4_19 = 419,
+            p4_20 = 420,
+            p4_21 = 421,
+            p4_22 = 422,
+            p4_23 = 423,
+            p4_24 = 424,
+            p4_25 = 425,
+            p4_26 = 426,
+            p4_27 = 427,*/
+            p4_28 = 428,
+            p4_29 = 429,
+            /*p4_30 = 430*/
+        
+        };
+    #endif /* _PIN_NAME_ */
+    
+    
+    class Digital_Out
+    {
+        private:    Pin _pin;
+        public:     Digital_Out(Pin_Name IPin)
+                    {
+                        _pin.port=(IPin/100);
+                        _pin.pin=(IPin%100);
+                        const int PINSELx = ((_pin.port*2) + (1* (_pin.pin > 15) ? 1:0));
+                        const int FIODIRx = _pin.port;
+                        
+                        *(uint32_t*)(_PINSEL_BASE + (PINSELx*4)) &= ~(1 << ((_pin.pin%16)*2) | (1 << (((_pin.pin%16)*2)+1)));          //GPIO
+                        *(uint32_t*)(_FIODIR_BASE + (FIODIRx*0x20)) |= (1 << _pin.pin);                                        //Output
+                    }
+                    
+                    Digital_Out(Pin_Name IPin, int value)
+                    {
+                        _pin.port=(IPin/100);
+                        _pin.pin=(IPin%100);
+                        const int PINSELx = ((_pin.port*2) + (1* (_pin.pin > 15) ? 1:0));
+                        const int FIODIRx = _pin.port;
+                        
+                        *(uint32_t*)(_PINSEL_BASE + (PINSELx*4)) &= ~(1 << ((_pin.pin%16)*2) | (1 << (((_pin.pin%16)*2)+1)));           //GPIO
+                        *(uint32_t*)(_FIODIR_BASE + (FIODIRx*0x20)) |= (1 << _pin.pin);                                        //Output
+                        *(uint32_t*)((_FIOSET_BASE*value) + (_FIOCLR_BASE*(1-value)) + (_pin.port*0x20)) |= (1 << _pin.pin);   //Write     
+                    }
+                    
+                    void write(int value)
+                    {
+                        if (value != 1 && value != 0) return;
+                        *(uint32_t*)((_FIOSET_BASE*value)+(_FIOCLR_BASE*(1-value)) + (_pin.port*0x20)) |= (1 << _pin.pin);     //Write     
+                    }
+                    
+                    int read()
+                    {
+                        return ((*(uint32_t*)(_FIOPIN_BASE +_pin.port*0x20) & (1 << _pin.pin)) >> _pin.pin);                          //Read
+                    }
+                    
+                    Digital_Out& operator= (int value)
+                    {
+                        write(value);
+                        return *this;
+                    }
+                    
+                    Digital_Out& operator= (Digital_Out& rhs)
+                    {
+                        write(rhs.read());
+                        return *this;
+                    }
+                    
+                    operator int()
+                    {
+                        return read();
+                    }
+    };
+
+#endif /*DIGITAL_OUT_H*/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/KS0108.lib	Sat Sep 27 18:43:15 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/DimiterK/code/KS0108/#e4b50f4c13a8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Steering.cpp	Sat Sep 27 18:43:15 2014 +0000
@@ -0,0 +1,293 @@
+#include "Steering.h"
+
+void HomeScreen()
+{
+    CANMessage Rxmsg;
+    ftc rcv;
+    rcv.FLOAT=0.0;
+    char dat[4];
+    float power_ratio=0.0;
+    printf("Homescreen\n\r");
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    display.GotoXY(0,0);
+    display.PrintString(" HOME SCREEN");
+    while( !(biSWTL.read() || biSWTR.read() || biSWBR.read()) )
+    {
+        if(CAN_Steering.read(Rxmsg))
+        {
+            for(int i=0; i<4; i++)
+                rcv.C_FLOAT[i]=Rxmsg.data[i];
+            if(Rxmsg.id == BATTERY_VOLTAGE_ID)
+            {
+                display.GotoXY(0,16);
+                display.PrintString(" PV: ");     
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+                display.PrintString("V");
+            }
+            if(Rxmsg.id == BATTERY_POWER_ID)
+            {
+                display.GotoXY(64,16);
+                display.PrintString(" PP: ");
+                power_ratio=rcv.FLOAT/10000;        
+                sprintf(dat,"%2.2f",power_ratio);
+                display.PrintString(dat);
+                display.PrintString("kW");
+            }
+            if(Rxmsg.id == PCM_STATE_ID)
+            {
+                display.GotoXY(0,32);
+                display.PrintString(" STATE: ");      
+                display.PrintNumber(rcv.FLOAT);
+            }
+        }
+    }    
+    return;    
+}
+
+void AMSScreen1()
+{
+    CANMessage Rxmsg;
+    ftc rcv;
+    char dat[4];
+    rcv.FLOAT=0.0;
+    printf("AMSScreen1");
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    while( !(biSWTL.read() || biSWTR.read() || biSWBL.read()) )
+    {
+        printf("iN LOOP1");
+        if(CAN_Steering.read(Rxmsg))
+        {
+            for(int i=0; i<4; i++)
+                rcv.C_FLOAT[i]=Rxmsg.data[i];
+            if(Rxmsg.id == BATTERY_VOLTAGE_ID)
+            {
+                display.GotoXY(0,0);
+                display.PrintString(" pv: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+            if(Rxmsg.id == BATTERY_POWER_ID)
+            {
+                display.GotoXY(0,16);
+                display.PrintString(" pp: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+            if(Rxmsg.id == BATTERY_CURRENT_ID)
+            {
+                display.GotoXY(0,32);
+                display.PrintString(" pi: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+            
+            //Column 2
+            if(Rxmsg.id == BATTERY_MIN_CELLVOLTAGE_ID)
+            {
+                display.GotoXY(49,0);
+                display.PrintString(" min cell V: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+            if(Rxmsg.id == BATTERY_MAX_CELLVOLTAGE_ID)
+            {
+                display.GotoXY(49,16);
+                display.PrintString(" max cell V: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+            if(Rxmsg.id == BATTERY_AVG_CELLVOLTAGE_ID)
+            {
+                display.GotoXY(49,32);
+                display.PrintString(" avg cell V: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+        }
+        screen=1;                 
+    }   
+    return;   
+}    
+
+void AMSScreen2()
+{
+    CANMessage Rxmsg;
+    ftc rcv;
+    char dat[4];
+    //ftc send;
+    rcv.FLOAT=0.0;
+    //send.FLOAT=65.6432;
+    printf("AMSScreen2\n\r");
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    while( !(biSWTL.read() || biSWTR.read() || biSWBL.read()) )
+    {
+        printf("iN LOOP2");
+        if(CAN_Steering.read(Rxmsg))
+        {
+            for(int i=0; i<4; i++)
+                rcv.C_FLOAT[i]=Rxmsg.data[i];
+            if(Rxmsg.id == BATTERY_MIN_CELLTEMPERATURE_ID)
+            {
+                display.GotoXY(0,0);
+                display.PrintString(" mn cll T: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+            if(Rxmsg.id == BATTERY_MAX_CELLTEMPERATURE_ID)
+            {
+                display.GotoXY(0,16);
+                display.PrintString(" mx cll T: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+            if(Rxmsg.id == BATTERY_AVG_CELLTEMPERATURE_ID)
+            {
+                display.GotoXY(0,32);
+                display.PrintString(" avg cell T: ");
+                sprintf(dat,"%2.2f",rcv.FLOAT);
+                display.PrintString(dat);
+            }
+            
+            //Column 2
+            if(Rxmsg.id == AMS_BATTERY_STATE)
+            {
+                if((rcv.C_FLOAT[0] & 0xC0) == 0xC0)
+                {
+                    display.GotoXY(70,0);
+                    display.PrintString(" AIRS: ");
+                    display.PrintString("CLOS");
+                }
+                else
+                {
+                    display.GotoXY(70,0);
+                    display.PrintString(" AIRS: ");
+                    display.PrintString("OPEN");
+                }
+                
+                if((rcv.C_FLOAT[0] & 0x04) == 0x04)
+                {
+                    display.GotoXY(70,16);
+                    display.PrintString(" Prchrg: ");
+                    display.PrintString("on");
+                }
+                else
+                {
+                    display.GotoXY(70,16);
+                    display.PrintString(" Prchrg: ");
+                    display.PrintString("off");
+                }                
+            }
+            if(Rxmsg.id == AMS_BATTERY_STATE)
+            {
+                display.GotoXY(70,16);
+                display.PrintString(" Prchrg: ");
+                display.PrintString("off");
+            }
+        }
+        screen=0;         
+    }
+    return;        
+}
+
+void ON()
+{
+    Txmsg_Drive.data[0]|=(1<<0);   
+    wait(0.1);
+    
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    display.GotoXY(26,16);
+    display.PrintString(" ON    INITIATED");
+    printf("ON Initiated\n\r");
+    //screen=0;
+    return;
+}
+
+void ResetCommand()
+{
+    Txmsg_Drive.data[0]&=~(1<<0);
+    wait(0.1);
+    
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    display.GotoXY(16,16);
+    display.PrintString(" RESET INITIATED");
+    printf("Reset Initiated\n\r");
+    //screen=0;
+    
+    return;
+}    
+
+void Powerstream()
+{
+    CANMessage Rxmsg;
+    float power_ratio;
+    ftc rcv;
+    rcv.FLOAT=0.0;
+    if(CAN_Steering.read(Rxmsg))
+    {   
+        if(Rxmsg.id == BATTERY_POWER_ID)
+        {
+            for(int i=0; i<4; i++)
+                rcv.C_FLOAT[i]=Rxmsg.data[i];
+            power_ratio=rcv.FLOAT/80000;
+            ledstream.write(power_ratio);
+        }
+    }   
+}
+
+void Init()
+{
+    pc.baud(230400);
+    CAN_Steering.frequency(500000);
+    for(int i = 0; i<4; i++)
+        drive[i] = (0x00);
+    ledstream.write(0);
+    call_ledstream.attach(&Powerstream,0.1);
+}
+
+int main()
+{
+    Init();
+    //int flag=1;
+    wait(0.1);
+    display.GotoXY(10,16);
+    display.SelectFont(Arial_14,BLACK,ReadData);
+    display.PrintString("Penn Electric Racing");
+    display.GotoXY(20,32); 
+    display.PrintString("Live The Dream");
+    screen=0;
+    wait(1);
+    
+    while(1)
+    {
+        if(biSWBL.read())
+            HomeScreen();
+        
+        if(biSWTR.read())
+        {
+            ON();
+            wait(1);
+            HomeScreen();
+        }
+        if(biSWTL.read())
+        {
+            ResetCommand();
+            wait(1);
+            HomeScreen();
+        }
+        if(biSWBR.read())
+        { 
+            if(screen)
+                AMSScreen2();
+            else
+                AMSScreen1();   
+        }
+        CAN_Steering.write(Txmsg_Drive);        
+        wait(0.3);    
+    }        
+}    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Steering.h	Sat Sep 27 18:43:15 2014 +0000
@@ -0,0 +1,106 @@
+#ifndef _STEERING_H
+#define _STEERING_H
+
+#include "mbed.h"
+#include "Digital_InOut.h"
+#include "KS0108.h"
+
+#include "Arial12.h"
+#include "Arial14.h"
+#include "Comic24.h"
+#include "vivaldi16.h"
+
+#define SWITCH_ID 410
+
+#define BATTERY_VOLTAGE_ID 0x304
+#define BATTERY_POWER_ID 0x306
+#define BATTERY_CURRENT_ID 0x305
+
+#define PCM_STATE_ID 20
+
+#define BATTERY_MIN_CELLVOLTAGE_ID 0x301
+#define BATTERY_MAX_CELLVOLTAGE_ID 0x300
+#define BATTERY_AVG_CELLVOLTAGE_ID 0x302
+
+#define BATTERY_MIN_CELLTEMPERATURE_ID 0x30A
+#define BATTERY_MAX_CELLTEMPERATURE_ID 0x309
+#define BATTERY_AVG_CELLTEMPERATURE_ID 0x30B
+#define AMS_BATTERY_STATE 0x30E          // AIRS 7 and 6 // Precharge 3
+
+Serial pc(USBTX,USBRX);
+CAN CAN_Steering(p9,p10);
+Digital_InOut CAN_Silent(p3_26, 0, output);
+
+KS0108 display(p26, p21, p22, p23, p25, p24, p8, p7, p6, p5, p13, p14, p12, p11); 
+Ticker call_ledstream;
+
+Digital_InOut l1(p1_28,1,output);//    SW2
+Digital_InOut l2(p1_26,1,output);//    SW4
+    
+Digital_InOut l3(p1_24,1,output);//    SW6
+Digital_InOut l4(p0_24,1,output);//    SW8
+
+Digital_InOut u1(p1_14,0,output);//    SW9 
+Digital_InOut u2(p1_9,0,output);//     SW11
+
+Digital_InOut u3(p1_4,0,output);//     SW13
+Digital_InOut u4(p1_0,0,output);//     SW15
+
+AnalogOut ledstream(p18);
+
+//SW1 - SW3
+Digital_InOut boSW1(p1_29,1,output);
+Digital_InOut biSWBR(p1_27,pull_down,input);     //BRight
+
+Digital_InOut boSW5(p1_25,1,output);
+Digital_InOut biSWBL(p1_22,pull_down,input);     //BLeft
+
+//Digital_InOut boSW5(P1_25,1,output);
+//Digital_InOut biSW7(P1_22,pull_down,input);
+
+Digital_InOut boSW10(p1_10,1,output);
+Digital_InOut biSWTR(p1_8,pull_down,input);     //TRight
+
+Digital_InOut boSW14(p1_1,1,output);
+Digital_InOut biSWTL(p0_25,pull_down,input);    //TLeft
+
+typedef union convert{
+        float FLOAT;
+        char C_FLOAT[4];
+        }ftc;
+
+char SwitchName[15][13]={
+    "fuse",
+    "ams",
+    "imd",
+    "pcm",
+    "brkp",
+    "lft",
+    "intl",
+    "brko",
+    "ckpt",
+    "rgt",
+    "hvd",
+    "tsms"
+};
+
+int SwitchPosition[13][2]={
+    {0,16},     //fuse
+    {25,16},    //ams
+    {50,16},    //imd
+    {70,16},    //pcm
+    {93,16},    //brkp
+    {117,16},   //lft
+    {0,32},     //intl
+    {17,32},    //brko
+    {42,32},    //ckpt
+    {65,32},    //rgt
+    {81,32},    //hvd
+    {102,32},   //tsm
+    };
+    
+int maxScreen=5;
+int screen; 
+char drive[4];
+CANMessage Txmsg_Drive(0x601,drive,sizeof(drive));
+#endif /* STEERING_H */    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SteeringTemp.h	Sat Sep 27 18:43:15 2014 +0000
@@ -0,0 +1,309 @@
+#include "Steering.h"
+
+void HomeScreen()
+{
+    CANMessage Rxmsg;
+    ftc rcv,send;
+    
+    send.FLOAT=45.4444;
+    Rxmsg.id=BATTERY_VOLTAGE_ID;
+    for(int i=0; i<4; i++)
+        Rxmsg.data[i]=send.C_FLOAT[i];
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    if(CAN_Steering.read(Rxmsg))
+    {
+        for(int i=0; i<4; i++)
+            rcv.C_FLOAT[i]=Rxmsg.data[i];
+        if(Rxmsg.id == BATTERY_VOLTAGE_ID)
+        {
+            display.GotoXY(0,0);
+            display.PrintString(" PV: ");     
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("V");
+        }
+        if(Rxmsg.id == BATTERY_POWER_ID)
+        {
+            display.GotoXY(0,16);
+            display.PrintString(" PP: ");        
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("KW");
+        }
+        if(Rxmsg.id == BATTERY_STATE_ID)
+        {
+            display.GotoXY(0,32);
+            display.PrintString(" STATE: ");      
+            display.PrintString(rcv.C_FLOAT);
+        }
+    }
+    wait(2);
+    return;    
+}
+
+/*
+void ShutdwnScreen()
+{
+    screen=1;
+    CANMessage Rxmsg;
+    uint16_t recv=0, temp=0, i=0;
+    //Test
+    
+        //uint16_t Rxpoll=15;
+        //char Result[4]={0};
+        //Result[0]=(char)(Rxpoll&0x00ff);
+        //Result[1]=(char)((Rxpoll&0xff00)>>8);
+        //CANMessage Rxmsg(410,Result,sizeof(Result));
+        
+    display.ClearScreen();
+    display.GotoXY(0,0);
+    display.SelectFont(Arial12,BLACK,ReadData);
+    display.PrintString("SHTDWN SWTCH OPEN");
+
+        if(CAN_Steering.read(Rxmsg))
+        {
+            if(Rxmsg.id == SWITCH_ID)
+            {
+                recv=(((uint16_t)Rxmsg.data[1]<<8) | (0x00ff&(uint16_t)Rxmsg.data[0]));
+                display.GotoXY(0,16);
+                while(i < 12)
+                {
+                    temp=recv;
+                    if(((temp & (1 << i))>>i) == 1)
+                    {
+                        display.GotoXY(SwitchPosition[i][0],SwitchPosition[i][1]);
+                        display.PrintString(SwitchName[i]);
+                    }    
+                }
+            }
+        }
+        return;    
+}    
+
+void AMS1Screen()
+{
+    screen=2;
+    CANMessage Rxmsg;
+    ftc rcv;
+    rcv.FLOAT=0.0;
+    
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+   
+    if(CAN_Steering.read(Rxmsg))
+    {
+        for(int i=0; i<4; i++)
+            rcv.C_FLOAT[i]=Rxmsg.data[i];
+        if(Rxmsg.id == BATTERY_VOLTAGE_ID)
+        {
+            display.GotoXY(0,0);
+            display.PrintString(" PV: ");     
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("V");
+        }
+        if(Rxmsg.id == BATTERY_POWER_ID)
+        {
+            display.GotoXY(0,16);
+            display.PrintString(" PV: ");     
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("KW");
+        }
+        if(Rxmsg.id == BATTERY_CURRENT_ID)
+        {
+            display.GotoXY(0,32);
+            display.PrintString(" PC: ");        
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("KW");
+        }
+    }   
+}
+
+void AMS2Screen()
+{
+    screen=3;
+    CANMessage Rxmsg;
+    ftc rcv;
+    rcv.FLOAT=0.0;
+    
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    
+    if(CAN_Steering.read(Rxmsg))
+    {   
+        for(int i=0; i<4; i++)
+                rcv.C_FLOAT[i]=Rxmsg.data[i];
+        if(Rxmsg.id == BATTERY_MIN_CELLVOLTAGE_ID)
+        {
+            display.GotoXY(0,0);
+            display.PrintString(" Min Cell V:");
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("V");
+        }
+        if(Rxmsg.id == BATTERY_MAX_CELLVOLTAGE_ID)
+        {
+            display.GotoXY(0,16);
+            display.PrintString(" Max Cell V:");
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("V");
+        }
+        if(Rxmsg.id == BATTERY_AVG_CELLVOLTAGE_ID)
+        {
+            display.GotoXY(0,32);
+            display.PrintString(" Max Cell V:");
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("V");
+        }
+    }   
+}
+
+void AMS3Screen()
+{
+    screen=4;
+    CANMessage Rxmsg;    
+    ftc rcv;
+    rcv.FLOAT=0.0;
+    
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    
+    if(CAN_Steering.read(Rxmsg))
+    {   
+        for(int i=0; i<4; i++)
+                rcv.C_FLOAT[i]=Rxmsg.data[i];
+        if(Rxmsg.id == BATTERY_MIN_CELLTEMPERATURE_ID)
+        {
+            display.GotoXY(0,0);
+            display.PrintString(" Min Cell T:");
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("deg");
+        }
+        if(Rxmsg.id == BATTERY_MAX_CELLTEMPERATURE_ID)
+        {
+            display.GotoXY(0,16);
+            display.PrintString(" Max Cell T:");
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("deg");
+        }
+        if(Rxmsg.id == BATTERY_AVG_CELLTEMPERATURE_ID)
+        {
+            display.GotoXY(0,32);
+            display.PrintString(" Avg Cell T:");
+            display.PrintNumber(rcv.FLOAT);
+            display.PrintString("deg");
+        }
+    }   
+}
+
+void AMS4Screen()
+{
+    screen =5;
+    CANMessage Rxmsg;
+    ftc rcv;
+    
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    
+    if(CAN_Steering.read(Rxmsg))
+    {   
+        for(int i=0; i<4; i++)
+                rcv.C_FLOAT[i]=Rxmsg.data[i];
+        if(Rxmsg.id == AMS_AIRS_ID)
+        {
+            display.GotoXY(0,0);
+            display.PrintString(" AIRS: ");
+            display.PrintString(rcv.C_FLOAT);
+        }
+        if(Rxmsg.id == AMS_PRECHARGING_ID)
+        {
+            display.GotoXY(0,16);
+            display.PrintString(" Precharging: ");
+            display.PrintString(rcv.C_FLOAT);
+        }
+    }   
+}
+*/
+void ON()
+{
+    char OnData[4]="ON";
+    CANMessage Txmsg(101,OnData,sizeof(OnData));
+    wait(0.1);
+    
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    display.GotoXY(16,16);
+    display.PrintString(" ON    INITIATED");
+    //screen=0;
+    return;
+}
+
+void ResetCommand()
+{
+    char ResetData[4]="RES";
+    CANMessage Txmsg(102,ResetData,sizeof(ResetData));
+    wait(0.1);
+    
+    display.ClearScreen();
+    display.SelectFont(Arial12,BLACK,ReadData);
+    display.GotoXY(16,16);
+    display.PrintString(" RESET INITIATED");
+    //screen=0;
+    
+    return;
+}
+
+void Init()
+{
+    pc.baud(230400);
+    CAN_Steering.frequency(500000);
+}
+
+int main()
+{
+    Init();
+    //int flag=1;
+    wait(0.1);
+    display.GotoXY(10,16);
+    display.SelectFont(Arial_14,BLACK,ReadData);
+    display.PrintString("Penn Electric Racing");
+    display.GotoXY(20,32); 
+    display.PrintString("Live The Dream");
+    screen=0;
+    wait(2);
+    
+    while(1)
+    {
+        if(biSWBL.read())
+            HomeScreen();
+        
+        if(biSWTR.read())
+            ON();
+        
+        if(biSWTL.read())
+            ResetCommand();
+        
+        printf("SCreen:%d\n\r",screen);        
+        wait(0.1);    
+    }   
+}    
+
+/*
+        else if(screen == 1)
+            ShutdwnScreen();  
+        else if(screen == 2)
+            AMS1Screen();    
+        else if(screen == 3)
+            AMS2Screen();    
+        else if(screen == 4)
+            AMS3Screen();    
+        else if(screen == 5)
+            AMS4Screen();    
+        */
+        /*
+        if(biSWBR.read())
+        {
+            if(screen == maxScreen)
+                screen=0;
+            else    
+                ++screen;
+            wait(1);
+        }
+        */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Sep 27 18:43:15 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721
\ No newline at end of file