Hello and a good morning from cold Germany!
So, I am not new to Arduino, been programming for about 4 Years or so but would not consider me an expert. If I ask anything stupid please let me know. I have done a lot of research on the following topic, I hope this is noticeable.
Arduino Uno with MCU2515 CANBus Shield
Later I will want to implement the project on a much faster NodeMCU32-S.
So, generally what I want to do is read out signals from a vehicle CAN-Bus.
All easy, I am receiving the Frames and Data.
My Problem more mathematical nature:
I receive Data in Hex Format. I know this is just a way of displaying it, as the processor is working binary anyway.
I need to convert the HEX Data into binary so I can then pick out the “interesting” bits, assemble them in a temporary variable and then convert that to DEC for display/logging.
I have the CAN-Database and know the Startbits, Lenghts and Faktor/Offset of the Signals I want to use – its just the problem of how to convert the incoming HEX Data to binary in a reasable way.
My Idea would be to use an array with a length 64. In this array I could then convert my HEX Data, then pick out the interesting bits ( For example: Startbit 12 Length 8), and save them in a variable.
If anyone could give me some advice on how this would be most efficient I would be very thankful.
I am not posting any code as the only working bit I have is to read out the Data from the Bus