Hi dear friends,
I would like to ask for some of your expertise to help me find the most effective solution for a problem I am facing.
I have a shift register attached to the SPI port of my arduino and what I need to do is send a 16 bit word to another microprocessor.
So the first problem is that I have two independent variables.
One has a with of 10 bits and other has a with of 6 bits. Now, if this was a 16 bit microprocessor I would simply merge them into an int and be done with that. But due to the 8bit nature of the arduino if i decide to merge both into a single word I then have to convert back into two bytes.
in addition to this, I need to run some code to make sure that if the 10bit word overflows, for example 11 bit, I wont have an issue with all the data being wrong. I defenitivelly need the 6 bit variable to always occupy the same bits (10-15)
How would I best deal with this?
God bless you all.