Just like that, but your array definition is all wrong:
'B0001' is not the same as B0001, B0001 is an number type, 'B0001' is an ASCII char type and will give the value 'B', decimal 66 (he other characters are ignored)
ok i have tried these and if the 8th bit (thats what i belive it is) if the upper most bit (left hand side when writing it) is 0 then it is ommitted but i need to send it as an 8 bit for the i2c i have running so i need it to have 8 bits and not emmit them. how can i ensure it can be used with all 8?
carbondudeoxide:
ok i have tried these and if the 8th bit (thats what i belive it is) if the upper most bit (left hand side when writing it) is 0 then it is ommitted but i need to send it as an 8 bit for the i2c i have running so i need it to have 8 bits and not emmit them. how can i ensure it can be used with all 8?
basically once i have done the bit shifting if i get a 8-bit binary with a 0 as the last bit (mot left bit one in blue) 01001010 instead of it remaining on the end it is ommited so the binary is displayed as 1001010 instead of 01001010 because i am using this 8-bit binary for an i2c project i need it to have all 8 bits in it. so what i am looking to do is force it to be an 8 bit regardless of it having a 0 on the end
carbondudeoxide:
basically once i have done the bit shifting if i get a 8-bit binary with a 0 as the last bit (mot left bit one in blue) 01001010 instead of it remaining on the end it is ommited so the binary is displayed as 1001010 instead of 01001010 because i am using this 8-bit binary for an i2c project i need it to have all 8 bits in it. so what i am looking to do is force it to be an 8 bit regardless of it having a 0 on the end
Still not quite sure if I'm understanding on your second attempt to explain, but let me take a whack...
Where is it being omitted? If you are concerned about only 1001010 being contained in the variable instead of 01001010, don't. You defined the variable as a byte, it will always have 8 bits in it. Some output/display methods may strip leading zeros, but the contents of the variable will still be all 8 bits.