Repository for CDMS code

Dependencies:   SimpleDMA mbed-rtos mbed eeprom

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Files at this revision

API Documentation at this revision

Comitter:
ee12b079
Date:
Thu Jan 07 10:35:40 2016 +0000
Parent:
34:f0b518523381
Child:
36:d1424f871de1
Child:
39:a41468817921
Child:
41:7e06018f6a1c
Child:
47:5660bd20b146
Commit message:
Relay_tmtc function, i2c.h, Flash.h, cdms_rtc.h added to the code, giving no errors. To be tested with CDMS TCs.

Changed in this revision

COM_MNG_TMTC.h Show annotated file Show diff for this revision Revisions of this file
DefinitionsAndGlobals.h Show annotated file Show diff for this revision Revisions of this file
Flash.h Show annotated file Show diff for this revision Revisions of this file
FreescaleIAP.lib Show annotated file Show diff for this revision Revisions of this file
Structures.h Show annotated file Show diff for this revision Revisions of this file
cdms_rtc.h Show annotated file Show diff for this revision Revisions of this file
i2c.h Show annotated file Show diff for this revision Revisions of this file
pinconfig.h Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Wed Jan 06 21:23:42 2016 +0000
+++ b/COM_MNG_TMTC.h	Thu Jan 07 10:35:40 2016 +0000
@@ -6,6 +6,30 @@
 // Jun 6
 // WHAT IS TC exec code in L1 ack ? 
 
+//Jan 7 
+//added RLY_TMTC function
+//added included related files
+
+#include "pinconfig.h"
+#include "i2c.h"
+#include "Flash.h"
+#include "cdms_rtc.h"
+
+DigitalIn tm_status_4m_slv(PIN39); //I2C interrupt to CDMS from BAE
+//DigitalIn tm_status_4m_pl(PIN61); //I2C interrupt to CDMS from PL
+
+uint8_t received = 0;
+uint16_t mid1;
+uint16_t mid2;
+uint16_t Nbytes;
+uint32_t Data[2];
+uint16_t nbytes;
+uint8_t flash_counter = 0;
+uint16_t crc16;
+uint16_t mid;
+uint32_t block;
+
+
 #define delete_TC(tc_ptr) {\
     if(tc_ptr == gHEAD_NODE_TCL){\
         gHEAD_NODE_TCL = tc_ptr->next_TC;\
@@ -398,9 +422,637 @@
 }
 
 // CDMS TEAM CODE START
-#define CDMS_RLY_TMTC(tc_ptr, tm_ptr){\
-    tm_ptr = NULL;\
-}\
+inline Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr){
+    uint8_t ACKCODE = 0x00;
+    printf("\rTC execution in progress\r\n");
+    Base_tm *tm_ptr = new Long_tm;
+    Base_tm *tm_pointer = tm_ptr;
+    received = 0;
+    switch(GETapid(tc_ptr))
+    {
+        case 1: //apid=01 implies it corresponds to bae
+        {
+            printf("Telecommand is for BAE\r\n");
+            printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae
+            FCTN_I2C_WRITE((char*)tc_ptr->TC_string);
+            while(1)
+            {
+                wait(1); //TimeOut instead of wait
+                if(tm_status_4m_slv == 1)
+                {
+                    printf("receiving...\r\n");
+                    FCTN_I2C_READ((char*)tm_pointer->TM_string);
+                    //printf("%s", tm_pointer->TM_string);
+                    received+=1;
+                    tm_pointer = tm_pointer->next_TM;
+                    break; //only for testing purpose
+                }
+                else
+                {
+                    break;
+                }
+            }
+            if(received >= 1 )
+            {
+                printf("Telemetry is received from BAE\r\n");
+                Base_tm *tm_print = tm_ptr;
+                for(uint8_t i=0;i<received;i++)
+                {  
+                    printf("%s", tm_print->TM_string);
+                    tm_print = tm_print->next_TM; //for check
+                }
+                received  = 0;
+                return tm_ptr;
+            }
+            else
+            {
+                printf("Telemetry is not received from BAE\r\n");
+                tm_pointer = new Short_tm;
+                tm_pointer->TM_string[0] = 0xB0;
+                tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
+                tm_pointer->TM_string[2] = 0x01;
+                tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
+                tm_pointer->TM_string[4] = 0x01;
+                for(uint8_t i=0;i<6;i++)
+                {
+                    tm_pointer->TM_string[i+5] = 0;
+                }
+                crc16 = crc16_gen(tm_ptr->TM_string,11);
+                tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                return tm_ptr;
+            }
+            break;
+        }
+        case 2:
+        {
+            printf("Telecommand is for CDMS\r\n"); //apid = 10 corresponds to cdms
+            switch(GETservice_type(tc_ptr))
+            {
+                case 0x60:
+                {
+                        printf("service:MMS\r\n");
+                        switch(GETservice_subtype(tc_ptr))
+                        {
+                            case 0x1:
+                            {
+                            printf("sub_service:Read from RAM_Memory\r\n");
+                            mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);                                                       
+                            {                                 
+                                    Data[0] = FCTN_CDMS_RD_FLASH(0);
+                                    Data[1] = FCTN_CDMS_RD_FLASH(1);
+                                    tm_pointer = new Long_tm;
+                                    tm_pointer->TM_string[0] = 0x30;
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
+                                    tm_pointer->TM_string[2] = (uint8_t)(flash_counter);
+                                    for(uint8_t i=0;i<4;i++)
+                                    {
+                                        tm_pointer->TM_string[3+i] = (uint8_t)((Data[0]>>(8*i))&0x00FF);
+                                    }
+                                    for(uint8_t i=4;i<8;i++)
+                                    {
+                                        tm_pointer->TM_string[3+i] = (uint8_t)((Data[1]>>(8*i))&0x00FF);
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,9);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                return tm_ptr;
+                            }                            
+                            case 0x2:
+                            {
+                            printf("sub_service:Read from Flash_Memory\r\n");
+                            mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);                           
+                            {                                                                 
+                                    Data[0] = FCTN_CDMS_RD_FLASH(0);
+                                    Data[1] = FCTN_CDMS_RD_FLASH(1);                                                                                             
+                                    tm_pointer = new Long_tm;
+                                    tm_pointer->TM_string[0] = 0x30;
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
+                                    tm_pointer->TM_string[2] = (uint8_t)(flash_counter);
+                                    for(uint8_t i=0;i<4;i++)
+                                    {
+                                        tm_pointer->TM_string[3+i] = (uint8_t)((Data[0]>>(8*i))&0x00FF);
+                                    }
+                                    for(uint8_t i=4;i<8;i++)
+                                    {
+                                        tm_pointer->TM_string[3+i] = (uint8_t)((Data[1]>>(8*i))&0x00FF);
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,9);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                return tm_ptr;
+                            }                           
+                            case 0x5:
+                            {
+                            printf("WRITE ON FLASH_MEMORY\r\n");                          
+                                    mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);                                   
+                                    block = (((uint32_t)(tc_ptr->TC_string[5])<<24)|((uint32_t)(tc_ptr->TC_string[5])<<16)|((uint32_t)(tc_ptr->TC_string[5])<<8)|((uint32_t)(tc_ptr->TC_string[5])));
+                                    FCTN_CDMS_WR_FLASH(mid,block);
+                                    tm_pointer = new Short_tm;
+                                    tm_pointer->TM_string[0] = 0xB0;
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
+                                    tm_pointer->TM_string[2] = 0x01;
+                                    tm_pointer->TM_string[3] = ACKCODE;  //ackcode to be decided
+                                    tm_pointer->TM_string[4] = 0x01;
+                                    for(uint8_t i=0;i<6;i++)
+                                    {
+                                        tm_pointer->TM_string[i+5] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                            }                                                    
+                            default:
+                            {
+                                printf("INVALID TC\r\n"); //Send Invalid TC Telemetry
+                                tm_pointer = new Short_tm;
+                                tm_pointer->TM_string[0] = 0xB0;
+                                tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
+                                tm_pointer->TM_string[2] = 0x01;
+                                tm_pointer->TM_string[3] = ACKCODE;  //ackcode to be decided
+                                tm_pointer->TM_string[4] = 0x01;
+                                for(uint8_t i=0;i<6;i++)
+                                {
+                                    tm_pointer->TM_string[i+5] = 0;
+                                }
+                                crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                return tm_ptr;                               
+                            }
+                            break;
+                        }
+                    }                                                                   
+                    case 0x8:
+                    {
+                        printf("service:FUNCTION MANAGEMENT SERVICE\r\n"); 
+                        if(GETservice_subtype(tc_ptr)==0x1)
+                            {                               
+                              if(GETpid(tc_ptr)==0x01)
+                                {
+                                    printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }                                
+                                else if(GETpid(tc_ptr)==0x02)
+                                {
+                                    printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                               else if(GETpid(tc_ptr)==0x03)
+                                {
+                                    printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x04)
+                                {
+                                    printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                    
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;                                   
+                                }
+                                else if(GETpid(tc_ptr)==0x11)
+                                {
+                                    printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x12)
+                                {
+                                    printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                    
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x13)
+                                {
+                                    printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x14)
+                                {
+                                    printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                    
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                 else if(GETpid(tc_ptr)==0x15)
+                                {
+                                    printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                 else if(GETpid(tc_ptr)==0x16)
+                                {
+                                    printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;                                   
+                                }
+                                else if(GETpid(tc_ptr)==0x21)
+                                {
+                                    printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x22)
+                                {
+                                    printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                    
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x23)
+                                {
+                                    printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x24)
+                                {
+                                    printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                 else if(GETpid(tc_ptr)==0x25)
+                                {
+                                    printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                 else if(GETpid(tc_ptr)==0x26)
+                                {
+                                    printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                    
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x31)
+                                {
+                                    printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x32)
+                                {
+                                    printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x33)
+                                {
+                                    printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0x34)
+                                {
+                                    printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0xC1)
+                                {
+                                    printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = ACKCODE;                                   
+                                    for(uint8_t i=3;i<11;i++)
+                                    {
+                                        tm_pointer->TM_string[i] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                    break;
+                                }
+                                else if(GETpid(tc_ptr)==0xF1)
+                                {
+                                    printf("RD_RTC\r\n"); //call RD_RTC
+                                    tm_pointer = new Short_tm;
+                                    tm_pointer->TM_string[0] = 0xD0;
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
+                                    tm_pointer->TM_string[2] = 0x01;
+                                    uint64_t time = FCTN_CDMS_RD_RTC();
+                                    tm_pointer->TM_string[3] = (uint8_t)((time&0xFF00000000000000)>>56);
+                                    tm_pointer->TM_string[4] = (uint8_t)((time&0x00FF000000000000)>>48);
+                                    tm_pointer->TM_string[5] = (uint8_t)((time&0x0000FF0000000000)>>40);
+                                    tm_pointer->TM_string[6] = (uint8_t)((time&0x000000FF00000000)>>32);
+                                    tm_pointer->TM_string[7] = (uint8_t)((time&0x00000000FF000000)>>24);
+                                    tm_pointer->TM_string[8] = (uint8_t)((time&0x0000000000FF0000)>>16);
+                                    tm_pointer->TM_string[9] = (uint8_t)((time&0x000000000000FF00)>>8);
+                                    tm_pointer->TM_string[10] = (uint8_t)(time&0x00000000000000FF);
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                }                               
+                                else 
+                                {
+                                    printf("INVALID TC\r\n");
+                                    tm_pointer = new Short_tm; 
+                                    tm_pointer->TM_string[0] = 0xB0; 
+                                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                                    tm_pointer->TM_string[2] = 0x01;
+                                    tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
+                                    tm_pointer->TM_string[4] = 0x01;
+                                    for(uint8_t i=0;i<6;i++)
+                                    {
+                                        tm_pointer->TM_string[i+5] = 0;
+                                    }
+                                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                                    return tm_ptr;
+                                }
+                            }                          
+                        }                      
+                    }                 
+                }
+                default:
+                {
+                    printf("INVALID TC"); //send invalid TC TM
+                    tm_pointer = new Short_tm; 
+                    tm_pointer->TM_string[0] = 0xB0; 
+                    tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                    tm_pointer->TM_string[2] = 0x01;
+                    tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
+                    tm_pointer->TM_string[4] = 0x01;
+                    for(uint8_t i=0;i<6;i++)
+                    {
+                        tm_pointer->TM_string[i+5] = 0;
+                    }
+                    crc16 = crc16_gen(tm_ptr->TM_string,11);
+                    tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                    tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                    return tm_ptr;
+                    break;
+                }
+            }
+        }
+        case 3:
+        {
+            printf("Telecommand is for PL\r\n");
+            // printf("Informing PL about TC using I2C\r\n"); //interrupt to be sent to the bae
+            // FCTN_I2C_WRITE((char*)tc_ptr->TC_string);
+            // printf("sent the Telecommand to BAE\r\n"); //packet along with crc will be sent when bae is ready
+            // wait(1); //wait time is to be optimised
+            // if(tm_status_4m_slv == 1)
+            // {
+            //     FCTN_I2C_READ((char*)tm_ptr->TM_string);
+            //     received = 1;
+            // }
+            // if(received == 1 )
+            // {
+            //     printf("Telemetry is received from BAE\r\n");
+            //     printf("%s", tm_ptr->TM_string);
+            //     received  = 0;
+            // } // similar to BAE functions
+            break;
+        }
+        default: //invalid TC
+        {
+            printf("INVALID TC\r\n");
+            tm_pointer = new Short_tm; 
+            tm_pointer->TM_string[0] = 0xB0; 
+            tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+            tm_pointer->TM_string[2] = 0x01;
+            tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
+            tm_pointer->TM_string[4] = 0x01;
+            for(uint8_t i=0;i<6;i++)
+            {
+                tm_pointer->TM_string[i+5] = 0;
+            }
+            crc16 = crc16_gen(tm_ptr->TM_string,11);
+            tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+            tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+            return tm_ptr;
+            break;
+        }
+     }
+}
 // CDMS TEAM CODE END
 
 // EXECUTE OBOSC
@@ -672,9 +1324,8 @@
                                 /*SKIP EXECUTION OF OBOSC HERE*/\
                             }\
                             else{\
-                                /*gPC.printf("cdms relay tmtc at %u\r\n", execute_psc);*/\
-                                /*call CDMS_RLY_TMTC*/\
-                                /*CDMS_RLY_TMTC(current_TC, put_tm_here);*/\
+                                gPC.printf("cdms relay tmtc at %u\r\n", execute_psc);\
+                                put_tm_here =  FCTN_CDMS_RLY_TMTC(current_TC);\
                             }\
                             /*DETECT ACK OR NACK*/\
                             uint8_t temp83 = 0x00;\
--- a/DefinitionsAndGlobals.h	Wed Jan 06 21:23:42 2016 +0000
+++ b/DefinitionsAndGlobals.h	Thu Jan 07 10:35:40 2016 +0000
@@ -14,6 +14,7 @@
     
 // COM_TX
     #define COM_TX_CONFIG_LIMIT 3
+    #define COM_TX_TICKER_LIMIT 32
 
 // ADF INTERRUPUT
     #define ADF_IRQ PTA14
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Flash.h	Thu Jan 07 10:35:40 2016 +0000
@@ -0,0 +1,28 @@
+#include "FreescaleIAP.h"
+
+int strt_add = flash_size() - (4*SECTOR_SIZE);  
+uint32_t flasharray[256+(3*1024)];
+char *nativeflash = (char*)strt_add;
+
+/*Writing to the Flash*/
+void FCTN_CDMS_WR_FLASH(uint16_t j,uint32_t block)
+{
+    for(int64_t i=0;i<(256+(3*1024));i++)
+    {
+        flasharray[i]=nativeflash[i];
+    }
+    flasharray[j]=block;
+    erase_sector(strt_add);
+    program_flash(strt_add, (char*)&flasharray,4*(256+(1024*3)));
+}
+/*End*/
+
+/*Reading from Flash*/
+uint32_t FCTN_CDMS_RD_FLASH(uint16_t j)
+{
+    for(int64_t i=0;i<(256+(3*1024));i++)
+    {
+        flasharray[i]=nativeflash[i];
+    }
+    return flasharray[j];
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FreescaleIAP.lib	Thu Jan 07 10:35:40 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/FreescaleIAP/#6749f7702fa5
--- a/Structures.h	Wed Jan 06 21:23:42 2016 +0000
+++ b/Structures.h	Thu Jan 07 10:35:40 2016 +0000
@@ -49,6 +49,10 @@
 #define GETapid(x) ( ( (x->TC_string[1]) & 0xA0 ) >> 6 )
 #define GETexec_status(x) ( (x->flags) & EXEC_STATUS_MASK )
 #define GETpacket_seq_count(x) (x->TC_string[0])
+#define GETservice_type(x) ( (x->TC_string[2]) & 0xF0 )
+#define GETservice_subtype(x) ( (x->TC_string[2]) & 0x0F )
+#define GETpid(x) (x->TC_string[3])
+
 
 //x should be a Base_tc pointer
 //y should be a 8-bit number with relevant data in LSB
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cdms_rtc.h	Thu Jan 07 10:35:40 2016 +0000
@@ -0,0 +1,148 @@
+void FCTN_CDMS_INIT_RTC()
+{
+    gCS_RTC=1;
+    spi.format(8,0);
+    spi.frequency(1000000);
+    //clearing the halt bit 
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x8C);
+    spi.write(0x00);
+     
+    //clearing the OF bit 
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x8F);
+    spi.write(0x00);
+     
+    //century bits
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x80|0x03);
+    spi.write(0x00);
+ 
+    //Kick starting the oscillator 
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x81); //register address with write flag
+    spi.write(0x80);//enabling stop bit in the seconds register
+ 
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x81);
+    spi.write(0x00);//disabling the stop bit to restart the oscillator 
+ 
+    
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x80); 
+    spi.write(0x01); // set milliseconds value to 00
+    gCS_RTC=1;
+ 
+    gCS_RTC=0;
+    spi.write(0x81); 
+    spi.write(0x01); //set seconds value to 00
+    gCS_RTC=1;
+ 
+    gCS_RTC=0;
+    spi.write(0x82); 
+    spi.write(0x01);//set minutes value to 00
+    gCS_RTC=1;
+ 
+    gCS_RTC=0;
+    spi.write(0x83); 
+    spi.write(0x23); //set the hours to 01
+    gCS_RTC=1;
+    
+    gCS_RTC=0;
+    spi.write(0x84); 
+    spi.write(0x01); //set day of the week to 01
+    gCS_RTC=1;
+    
+    gCS_RTC=0;
+    spi.write(0x85); 
+    spi.write(0x31); //set date of the month to 01
+    gCS_RTC=1;
+    
+    gCS_RTC=0;
+    spi.write(0x86); 
+    spi.write(0x12); //set month to 01
+    gCS_RTC=1;
+    
+    gCS_RTC=0;
+    spi.write(0x87); 
+    spi.write(0x01); //set year to 00(2000)
+    gCS_RTC=1;
+    printf("\n\r rtc initalised \n");
+}
+ 
+uint64_t FCTN_CDMS_RD_RTC()
+{    
+    uint8_t response;
+    printf("\n\r Entered rtc\n");
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x00); //reading milliseconds register
+    response = spi.write(0x00); // read the value by sending dummy byte
+    uint8_t centiseconds =  (uint8_t(response&0xF0)>>4)*10+uint8_t(response&0x0F)*1;
+    
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x01); //reading seconds register
+    response =spi.write(0x01);
+    uint8_t seconds =  ((response&0x70)>>4)*10+(response&0x0F)*1;
+    
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x02); //reading minutes register
+    response =spi.write(0x01);
+    uint8_t minutes =  ((response&0xF0)>>4)*10+(response&0x0F)*1;
+    
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x03); //reading hours register
+    response=spi.write(0x01);
+    uint8_t hours =  ((response&0x30)>>4)*10+(response&0x0F)*1;
+    
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x04); //reading day's  register
+    uint8_t day =spi.write(0x01);
+    
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x05); //reading date register
+    response =spi.write(0x01);
+    uint8_t date =  ((response&0x30)>>4)*10+(response&0x0F)*1;
+    
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x06); //reading month registe
+    response =spi.write(0x01);
+    uint8_t month =  ((response&0x10)>>4)*10+(response&0x0F)*1;
+    
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x07); //reading year's registe
+    response =spi.write(0x01);
+    uint8_t year =  ((response&0xF0)>>4)*10+(response&0x0F)*1;
+    gCS_RTC=1;
+    //sprintf(Time_stamp,"%02d%02d%02d%02d%02d%02d%02d%02d",year, month, date, day, hours, minutes, seconds, milliseconds );
+    uint8_t Time_stamp[8] = {year, month, date, day, hours, minutes, seconds, centiseconds};
+    for(int i= 0; i<8;i++)
+        printf("%d\t",Time_stamp[i]);
+    printf("read\r\n");
+    uint64_t time;
+    time = 0;
+    time = time|(((uint64_t)(centiseconds&0x7F)));
+    time = time|(((uint64_t)(seconds&0x3F))<<7);
+    time = time|(((uint64_t)(minutes&0x3F))<<13);
+    time = time|(((uint64_t)(hours&0x1F))<<19);
+    time = time|(((uint64_t)(day&0x1F))<<24);
+    time = time|(((uint64_t)(month&0x07))<<29);
+    time = time|(((uint64_t)(year&0x03))<<33);
+    time = (time&0x00000007FFFFFFFF);
+    //printf("\n\r%x%x", (int)(time >> 32), (int)(time));
+    printf("\n\r0x%016llx\n\r", time);
+   return time;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/i2c.h	Thu Jan 07 10:35:40 2016 +0000
@@ -0,0 +1,61 @@
+#define tm_len 134
+#define tc_len 135
+#define tc_test_len 135
+
+DigitalOut irpt_2_slv(PIN67);                                        //I2C interrupt to CDMS
+I2C master(PIN32,PIN31);
+DigitalOut led1(PIN46);
+DigitalOut led2(PIN95);
+const int addr = 0x20;                                            //slave address 
+char telecommand[tc_len];
+char telemetry[tm_len];
+Timer test;
+Timer t_read;
+bool write_ack = true;
+bool read_ack = true;
+
+int count = 0;
+
+void FCTN_I2C_WRITE(char *data)
+{
+    irpt_2_slv = 1;
+    //t.start();
+    write_ack = master.write(addr|0x00,data,tc_len);
+    //t.stop();
+    //if(write_ack == 0)
+        //pc.printf("\n\r data not sent \n");
+       
+if (write_ack == 1)
+    {
+        led2 = 1;
+        printf("\n\r data not sent \n");
+        led2 = 0;    
+    }
+    irpt_2_slv = 0;
+    //pc.printf("\n\r %d \n",t.read_us());
+    //t.reset();
+}
+
+
+void FCTN_I2C_READ(char *data)
+{
+    irpt_2_slv = 1; 
+    t_read.start();
+    read_ack = master.read(addr|1,data,tm_len);
+    t_read.stop();
+   
+    //if(read_ack == 0)
+      //  printf("\n\rData received from BAE %s \n",data);
+ if (read_ack == 1)
+    {
+        led2 = 1;
+        printf("\n \r data not received \n");
+        led2 = 0;
+    }
+//if(read_ack == 1)
+//pc.printf("\n \r data not received \n");
+
+    irpt_2_slv = 0;
+    //printf("\n\r %d \n",t.read_us());
+    //t.reset();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pinconfig.h	Thu Jan 07 10:35:40 2016 +0000
@@ -0,0 +1,101 @@
+// 100 LQFP format pin assignment
+#define PIN1 PTE0
+#define PIN2 PTE1
+#define PIN3 PTE2
+#define PIN4 PTE3
+#define PIN5 PTE4
+#define PIN6 PTE5
+#define PIN7 PTE6
+//#define 8 
+//#define 9 
+//#define 10 
+//#define 11 
+//#define 12 
+//#define 13 
+#define PIN14 PTE16
+#define PIN15 PTE17
+#define PIN16 PTE18
+#define PIN17 PTE19
+#define PIN18 PTE20
+#define PIN19 PTE21
+#define PIN20 PTE22
+#define PIN21 PTE23
+//#define 22 
+//#define 23 
+//#define 24 
+//#define 25 
+#define PIN26 PTE29
+#define PIN27 PTE30
+#define PIN28 PTE31
+//#define 29 
+//#define 30 
+#define PIN31 PTE24
+#define PIN32 PTE25
+#define PIN33 PTE26
+#define PIN34 PTA0
+#define PIN35 PTA1
+#define PIN36 PTA2
+#define PIN37 PTA3
+#define PIN38 PTA4
+#define PIN39 PTA5
+#define PIN40 PTA6
+#define PIN41 PTA7
+#define PIN42 PTA12
+#define PIN43 PTA13
+#define PIN44 PTA14
+#define PIN45 PTA15
+#define PIN46 PTA16
+#define PIN47 PTA17
+//#define 48 
+//#define 49 
+#define PIN50 PTA18
+#define PIN51 PTA19
+#define PIN52 PTA20
+#define PIN53 PTB0
+#define PIN54 PTB1
+#define PIN55 PTB2
+#define PIN56 PTB3
+#define PIN57 PTB7
+#define PIN58 PTB8
+#define PIN59 PTB9
+#define PIN60 PTB10
+#define PIN61 PTB11
+#define PIN62 PTB16
+#define PIN63 PTB17
+#define PIN64 PTB18
+#define PIN65 PTB19
+#define PIN66 PTB20
+#define PIN67 PTB21
+#define PIN68 PTB22
+#define PIN69 PTB23
+#define PIN70 PTC0
+#define PIN71 PTC1
+#define PIN72 PTC2
+#define PIN73 PTC3
+//#define 74 
+//#define 75 
+#define PIN76 PTC20
+#define PIN77 PTC21
+#define PIN78 PTC22
+#define PIN79 PTC23
+#define PIN80 PTC4
+#define PIN81 PTC5
+#define PIN82 PTC6
+#define PIN83 PTC7
+#define PIN84 PTC8
+#define PIN85 PTC9
+#define PIN86 PTC10
+#define PIN87 PTC11
+#define PIN88 PTC12
+#define PIN89 PTC13
+#define PIN90 PTC16
+#define PIN91 PTC17
+#define PIN92 PTC18
+#define PIN93 PTD0
+#define PIN94 PTD1
+#define PIN95 PTD2
+#define PIN96 PTD3
+#define PIN97 PTD4
+#define PIN98 PTD5
+#define PIN99 PTD6
+#define PIN100 PTD7
\ No newline at end of file