We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I have following code: Unsigned int freq; int N_counter[24] freq=248;
N_Counter[15]=(freq& 0x0001); N_Counter[14]=(freq & 0x0002); N_Counter[13]=(freq & 0x0004); N_Counter[12]=(freq & 0x0008); N_Counter[11]=(freq & 0x0010); N_Counter[10]=(freq & 0x0020); N_Counter[9]=(freq & 0x0040); N_Counter[8]=(freq & 0x0080);
Since freq is equal to 11111000 then by doing and operation " N_Counter[15]=(freq & 0x0001);"for example "0" is coppied to N_counter[15] and so on all the way to N_counter[8].I expect these binaries to be coppied into N_counter[15] to N_counter[8] and I used this code with Micro vision 2 8051 compiler in the past but it's not working with MDK-ARM, For example "N_Counter[8]=(freq & 0x0080);" should result 1 copied to N_counter[8] but instead 0 is copied into N_counter[8].Can you help me with this problem?
I fixed my own problem,
Here is the solution if anybody interested
if(freq & 0x0001) N_Counter[15]=1; else N_Counter[15]=0;
If anybody has a better solution, please let me know.
Abbas68@yahoo.com