Hi, I'm trying to access SFR memory using the hexa address of the SFR and using only "C" instructions. Since SFR memory is accessed by direct addressing mode, like the first 128 bytes of internal RAM, I tried to use the following instruction :
* ((unsigned char data *) 0xA8) = 0x1;
MOV R0,#0A8H MOV @R0,#01H
* ((unsigned char idata *) 0xA8) = 0x1;
Yes, and you use sbit, sfr, sfr16 to access them. Assembler allows you to do anything so I'll ignore that here. When you do it in Assembler, you choose the appropriate Addressing Mode and/or mnemonic yourself; it's the sbit, sfr, sfr16 which tell the compiler that you're accessing an SFR and therefore what Addressing Mode and/or mnemonic to use.
How did what I said contradict what you said? I said, "Assembler allows you to do anything so I'll ignore that here." The OP is asking about how to do this in C but quoted irrelvant text about assembler. - Mark
How did what I said contradict what you said? No contradiction! Just adding some detail (which, as you say, was not essential to main 'C' discussion). "Reply" doesn't necessarily imply "Disagree" - sorry if it sounded that way.
"Reply" doesn't necessarily imply "Disagree" - sorry if it sounded that way. My fault. I was being overly sensitive. Please ignore me. Regards. - Mark