??? 01/13/05 10:44 Read: times |
#84910 - RE: zero out bitvars at startup Responding to: ???'s previous message |
CLR bit will only clear directly addressed bits. In fact, NO INSTRUCTION on the 8051 allows you to address bits indirectly.
CLR R0 does NOT clear the bit at the bit address "held in R0". It is an example of wishful thinking. Do not use wishful thinking when programming, use the facts stated in the instruction set overview. DOWNLOAD THE "BIBLE" IN THE LINKS SECTION AND STUDY IT UNTIL YOU PUKE. Your R0 will not be seen by the assembler as a register. It will be seen as a constant value (label). Strange by the way that your assembler doesn't protest. The only way to do what you want to do is to do it on a per byte manner, which will involve some calculation of the byte address where the bit you want to clear is located, some shifting and some masking. My estimation is: too much work for what you are trying to accomplish. |
Topic | Author | Date |
zero out bitvars at startup | 01/01/70 00:00 | |
RE: zero out bitvars at startup | 01/01/70 00:00 | |
RE: zero out bitvars at startup | 01/01/70 00:00 | |
RE: zero out bitvars at startup | 01/01/70 00:00 | |
Other approach | 01/01/70 00:00 | |
compiler does not clear ??? | 01/01/70 00:00 | |
yes it does![]() | 01/01/70 00:00 |