Hello everyone !
I have am personal project of a car battery charger that needs some calibrations (voltage, current and some other particular parameters). Considering the fact that I intend to produce a great number of this chargers, I want to make a special device that will calibrate the charger automatically, simply and fast by connecting it to the output socket of the charger (without opening the charger case). And for this I need that that device (let's call it "Calibrator") to send some data to the charger, and charger to be able to recognize that data.
At the hardare level I want to do that communication by sending data packets composed from: A,B,C, where:
- A - is a 10ms continuous HIGH state pulse;
- B - is the address part (a bite that will tell to the charger in which subroutine should go);
- C - is the data part (a bite that will tell to the charger some service data - for example: write the serial number).
Each bit from the data packet will be read by the same ADC port that reads the voltage at the car battery output. Because of the delay given by the RC filter placed before this ADC, in order to have all the bits correctly read, each bit will be transmitter for a period of 1ms.
Now, the problem is that I need a piece of code that could:
- read the data packet;
- extract the address and data parts;
- converts the extracted data to decimal numbers so I could use them with the rest of the code.
In order to read the data packet I think I could declare 8 +8 variable (8 for address part and 8 for data part). But until now I don't have any idea about how could I convert the content of 8 Boolean numbers in a decimal number.
So this is now my problem: how could I convert 8 (or in fact, any other) number of boolean variables into a decimal number.
Do you have any idea that would help me with this conversion?
P.S. If you may have any other idea about how could I send small piese o data from my Calibrator to my charger, please share them with me :).
Regards,
Ciprian