void SeplosBms_Write() { uint8_t Tx1Data[] = {0x7E, 0x32, 0x30, 0x30, 0x30, 0x34, 0x36, 0x34, 0x34, 0x45, 0x30, 0x30, 0x32, 0x30, 0x30, 0x46, 0x44, 0x33, 0x35, 0x0D}; // Get #0pack Telecommand Data. uint8_t Tx2Data[] = {0x7E, 0x32, 0x30, 0x30, 0x30, 0x34, 0x36, 0x30, 0x30, 0x31, 0x30, 0x34, 0x42, 0x30, 0x30, 0x46, 0x44, 0x33, 0x42, 0x0D}; // Get #0pack CID2 NORMAL Data. uint8_t Tx3Data[] = {0x7E, 0x32, 0x30, 0x30, 0x30, 0x34, 0x36, 0x34, 0x32, 0x45, 0x30, 0x30, 0x32, 0x30, 0x30, 0x46, 0x44, 0x33, 0x37, 0x0D}; // Get #0pack telemetry Data. HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, GPIO_PIN_SET); HAL_UART_Transmit(&huart1, Tx1Data, sizeof(Tx1Data), 1000); HAL_Delay(500); HAL_UART_Transmit(&huart1, Tx2Data, sizeof(Tx2Data), 1000); HAL_Delay(500); HAL_UART_Transmit(&huart1, Tx3Data, sizeof(Tx3Data), 1000); HAL_Delay(500); } void SeplosBms_Read() { for(int i=0; i<=75; i++) { if(HAL_UART_Receive(&huart1, RxData, sizeof(RxData), 1000) == HAL_OK) // Bu kısım değişecek // { HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOD, GPIO_PIN_15, GPIO_PIN_SET); } ReceiveData[a] = RxData[i]; uint8_t a =0; uint8_t b =0; flag = (uint8_t)(ReceiveData[a] << (b)); a+=1; CmdGROUP = (uint8_t)(ReceiveData[a] << (b+8)); a+=1; b+=8; NmbOfCells = (uint8_t)(ReceiveData[a] << (b+8)); a+=1; b+=8; VoltageCells1 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells2 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells3 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells4 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells5 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells6 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells7 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells8 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells9 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells10 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells11 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells12 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells13 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells14 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; VoltageCells15 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; NmbOfTmp = (uint8_t)(ReceiveData[a] << (b+8)); a+=1;b+=8; TemperatureCells1 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; TemperatureCells2 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; TemperatureCells3 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; TemperatureCells4 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; TemperatureCells5 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; TemperatureCells6 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; TemperatureCells7 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; TemperatureCells8 = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; ChargeDıschargeCurrent = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; TotalBatteryVoltage = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; ResidualCapacity = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; CustomNumber = (uint8_t)(ReceiveData[a] << (b+8)); a+=1;b+=8; BatteryCapacity = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; SOC = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; RatedCapacity = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; NumberOfCycle = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; SOH = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; PortVoltage = (uint16_t)((ReceiveData[a] << (b+16))| (ReceiveData[a+1] << (b+8))); a+=2; b+=16; HAL_Delay(1000); a=i++; } }