??? 01/13/05 10:23 Read: times |
#84909 - zero out bitvars at startup |
Hi,
I'd like to modify my cstartup.s03 file so it will put my bit variables in a predicyed state. My compiler (IAR) doesn't allow initialization of bit variables so I want to clear them. One 'dirty' solution would be to at the very begining of the startup file just clear the "byte adresses" 20h-2Fh which corresponds to "bit addresses" 00h-7Fh. But I'd like to only clear the bits that are actually used as bit variables (one might want some bits to remain there values at a manual reset) Why doesn't this code work? MOV R0,#SFB(BITVARS) SJMP CLEAR_BITVAR_2 CLEAR_BITVAR: CLR R0 INC R0 CLEAR_BITVAR_2: CJNE R0,#SFE(BITVARS),CLEAR_BITVAR SFB(BITVARS) and SFE(BITVARS) resolves to bit variable addresses. I suspect that the problem is in the "CLR R0" line. I've also tested with "CLR @R0" but that results in: "Error[43]: Illegal effective address" |
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 |