??? 02/03/09 12:55 Read: times |
#161990 - C51 compiler - Writing to a bit, using an index |
Hi,
I am working on a 8051 based project at present, using a C51 compiler on the Keil IDE. I have run into this issue. Please do take a look. I have the following variables-- bdata char var1; char index; // index will hold values from 0 to 7 and // refers to the bit no. of var1, which I have to access bit result; When index=2(say), I can assign the value of the second bit of var1 to result- result=var1^index; , but it does not work the other way around var1^index=result; This throws an error. Could someone please suggest a workaround? How do I write to a specific bit of a byte in the bit addressable region, when the bit number is stored in another variable? Thanks Arindam |
Topic | Author | Date |
C51 compiler - Writing to a bit, using an index | 01/01/70 00:00 | |
Note that ^ also represents xor | 01/01/70 00:00 | |
Ouch!!! | 01/01/70 00:00 | |
Is there a way to use a pointer to access a bit | 01/01/70 00:00 | |
Just use plain C. | 01/01/70 00:00 | |
Just use plain C![]() | 01/01/70 00:00 |