Hello,
Im doing a project that i need to split up the first 6 bytes of an array individually. The first 3 bytes needs to be in Binary and the remaining 3 need to be in HEx. Any ideas , as i've only started learning C today!
Shane
Hello,
Im doing a project that i need to split up the first 6 bytes of an array individually. The first 3 bytes needs to be in Binary and the remaining 3 need to be in HEx. Any ideas , as i've only started learning C today!
Shane
What is the type of the array?
What is the contents?
What do you mean by split?
All data in computer - is binary, when talking about hex - talking about representation of the data. So how do you want to represent (print out) your data?
start with some code
Code:int main(void) { return 0; }
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
honestly i don't know , but attached is the array
could u point me in the right dirtection
I need 128 to 152 to be sperated individually if that makes sence
Last edited by shanem; 01-22-2009 at 10:22 AM.
....
Ok i'll try to be a bit more clear, The 128 value corresponds to 1000000
On my data sheet for this represents "Slave is in sync mode"
If the value comes in at 46 -101110 for example " Slave is in sync mode , freeze off ,slave is locked, watch dog on....) etc.
The second third fourth fifth and sixth bytes needs to be represented the same way.
So what i need to do is split up the first 6 bytes on the array, get there binary values and match that to my reference guide and display these messages in a text box!
Any takers,
128 in binary is 10000000.
So, what, you have a list like this:
and you want to know whether that particular bit is set? So why not do bitwise and?Code:#define SYNC_MODE 64 #define FREEZE 32 #define LOCKED 16 #define WATCHDOG 8