Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of workinQM_5thJan_azad by
Diff: BCN.cpp
- Revision:
- 99:2cc5c0c98cb3
- Parent:
- 98:321edb143f26
- Child:
- 101:cf1976e16f28
--- a/BCN.cpp Tue Feb 14 16:18:16 2017 +0000 +++ b/BCN.cpp Thu Mar 09 07:42:15 2017 +0000 @@ -56,6 +56,7 @@ extern uint8_t crc8_short(); extern uint8_t float_to_uint8(float min,float max,float val); +extern float Read_I_B_IN_BCN(); void SHORT_HK_data_AQ() { @@ -71,8 +72,8 @@ SHORT_HK_data[5] = 0x28; SHORT_HK_data[6] = 0x8A; - SHORT_HK_data[7] = quant_data.voltage_quant[15]/10; - SHORT_HK_data[7] = (SHORT_HK_data[7] & 0xF0) | (quant_data.current_quant[1]>>4); + SHORT_HK_data[7] = (quant_data.voltage_quant[0]/10)<<4; // bat voltage: changed by samp from quant_data.voltage_quant[15] to quant_data.voltage_quant[0] + SHORT_HK_data[7] = (SHORT_HK_data[7] & 0xF0) | (quant_data.current_quant[0]/100); //>>4, solar bus current changed from quant_data.current_quant[1] to quant_data.current_quant[0] //taking only the most significant bits SHORT_HK_data[8] = actual_data.bit_data_acs_mg[0]>>8; @@ -82,32 +83,35 @@ SHORT_HK_data[9] = (SHORT_HK_data[9]&0xF0) | BAE_RESET_COUNTER>>4; + //RETURN_UPTIME(BAE_uptime.read(),&days,&hours,&mins); RETURN_UPTIME(BAE_uptime.read(),&days,&hours,&mins); - SHORT_HK_data[10] = CDMS_OC_FAULT; - SHORT_HK_data[10] = (SHORT_HK_data[10]<<1) | 0;//receiver_oc_fault//to be diss - Is it (tc[10]>>1)&0x01 ? - SHORT_HK_data[10] = (SHORT_HK_data[10]<<6) | ((quant_data.voltage_quant[5])&0x3C); - SHORT_HK_data[10] = (SHORT_HK_data[10]) | ((days>>3)&0x03); - SHORT_HK_data[11] = (days<<5) | (hours&0x1F); + + SHORT_HK_data[10] = ~CDMS_OC_FAULT<<7; + SHORT_HK_data[10] = (SHORT_HK_data[10]) | 0;//receiver_oc_fault//to be diss - Is it (tc[10]>>1)&0x01 ? + SHORT_HK_data[10] = (SHORT_HK_data[10]) | (((quant_data.voltage_quant[5]/4)<<2)&0x3C); + SHORT_HK_data[10] = (SHORT_HK_data[10]) | ((hours>>2)&0x03);// just for testing purpose change it to days 5 bits ((days>>3)&0x03) + SHORT_HK_data[11] = (hours<<6) | (mins&0x3F);//(days<<5) | (hours&0x1F); + + pc_bcn.printf("\n\n\r bae uptime in hrs = %x\n",hours); + pc_bcn.printf("\n\n\r bae uptime in min = %x\n",mins); RETURN_UPTIME(I2C_last.read(),&days,&hours,&mins); - SHORT_HK_data[12] = EPS_CHARGER_STATUS; - SHORT_HK_data[12] = (SHORT_HK_data[12]<<4) | (quant_data.voltage_quant[6]>>2); - SHORT_HK_data[12] = (SHORT_HK_data[12]<<3) | (days>>2); + SHORT_HK_data[12] = EPS_CHARGER_STATUS<<7; + SHORT_HK_data[12] = (SHORT_HK_data[12])| (((quant_data.voltage_quant[6]/3)<<3)&0x78); + SHORT_HK_data[12] = (SHORT_HK_data[12]) | (days>>2); SHORT_HK_data[13] = (days<<6) | (mins&0x3F); - //change it daaa.!! - for(int ib = 7;ib<14;ib++) - SHORT_HK_data[ib]=0x1; + SHORT_HK_data[14] = crc8_short(); - SHORT_HK_data[14] = crc8_short(); - #if short_bcn_print pc_bcn.printf("\n\rShort BCN data:\n"); for(int ib = 0;ib<15;ib++) pc_bcn.printf("\n\r%02x",SHORT_HK_data[ib]); pc_bcn.printf("\n\rV_D = %d\n",quant_data.voltage_quant[6]); pc_bcn.printf("V_C = %d\n",quant_data.voltage_quant[5]); pc_bcn.printf("V_C in bits = %x\n",(quant_data.voltage_quant[5])&0x3C); - + pc_bcn.printf("solar current = %d\n",quant_data.current_quant[0]); + pc_bcn.printf("\n\ruptime = %f\n",BAE_uptime.read()); + #endif } @@ -403,6 +407,7 @@ } } + Read_I_B_IN_BCN(); wait_ms(70); if( BCN_SW == 1 )