Since the data is in a nice binary format that is compatible with the UNO, I would not mess with converting the individual bytes. Define a struct that matches the data structure, manipulate the values in that, and send the struct to the CAN bus.
byte rx_frame[8] = {0XB6, 0X0B, 0XC5, 0X01, 0XC5, 0X0B, 0XB1, 0X00};//incoming data from battery monitor
struct {
uint16_t voltage;
int16_t current;
int16_t temperature;
uint8_t unused;
uint8_t stateOfCharge;
} pdo1;
void setup() {
// start Serial communication
Serial.begin(9600);
memcpy(&pdo1, rx_frame, sizeof(pdo1));
Serial.print("Voltage = ");
Serial.print(pdo1.voltage / 100.0);
Serial.print(" , Current = ");
Serial.print(pdo1.current / 100.0);
Serial.print(" , temperature = ");
Serial.print(pdo1.temperature / 100.0);
Serial.print(" , state of charge = ");
Serial.print(pdo1.stateOfCharge);
Serial.println('%');
//print hex values
uint8_t* ptr = (uint8_t*)&pdo1;
for (size_t i = 0; i < sizeof(pdo1); i++) {
if (*ptr < 0x10) Serial.print('0');
Serial.print(*ptr, HEX);
Serial.print(' ');
ptr++;
}
Serial.println();
//change values
pdo1.voltage = 30.01 * 100.0;
pdo1.current = 7.91 * 100.0;
pdo1.temperature = 25.62 * 100.0;
Serial.print("Voltage = ");
Serial.print(pdo1.voltage / 100.0);
Serial.print(" , Current = ");
Serial.print(pdo1.current / 100.0);
Serial.print(" , temperature = ");
Serial.print(pdo1.temperature / 100.0);
Serial.print(" , state of charge = ");
Serial.print(pdo1.stateOfCharge);
Serial.println('%');
//print hex values
ptr = (uint8_t*)&pdo1;
for (size_t i = 0; i < sizeof(pdo1); i++) {
if (*ptr < 0x10) Serial.print('0');
Serial.print(*ptr, HEX);
Serial.print(' ');
ptr++;
}
Serial.println();
//probable way to send data to the can bus
//CAN.write((uint8_t*)&pdo1, sizeof(pdo1));
}
void loop() {
}