??? 04/07/09 18:38 Read: times |
#164466 - Oops. I used a wrong example Responding to: ???'s previous message |
Sorry. I do not often write any memory-mapped 8051 code. I just looked up the macro definition, but did not check where I had actually used it.
The reason for not using a function-like XBYTE(x) macro is because I am using it as a char array. Incidentally in my header file, the SDCC version does not use the volatile keyword. The Wickenhauser versions uses volatile. In theory you should use volatile and it is worth trying with the current SDCC compiler. #define XBYTE ((unsigned char volatile xdata *) 0) ... #define pio_ctl XBYTE[0x1234] ... pio_ctl = value; ... There are several different ways of writing this sort of macro. Effectively you are just casting a memory pointer to a constant and using the contents. It is a horrible construction that is best written ONCE and hidden in a macro. And Yes, you can write it as a function_like(x) macro. Of course you can do something similar with the _at_ keyword but you can have portability problems. xdata is more commonly used than _at_ David. |
Topic | Author | Date |
How to access memory mapped 8255 with SDCC? | 01/01/70 00:00 | |
also asked here: | 01/01/70 00:00 | |
8255 with SDCC | 01/01/70 00:00 | |
Wrong question? | 01/01/70 00:00 | |
It's C | 01/01/70 00:00 | |
not on the 8051 | 01/01/70 00:00 | |
Oh yes it is! | 01/01/70 00:00 | |
Use XBYTE macro | 01/01/70 00:00 | |
Isn't there a problem with that? | 01/01/70 00:00 | |
Oops. I used a wrong example | 01/01/70 00:00 | |
Portability | 01/01/70 00:00 | |
like this... | 01/01/70 00:00 | |
How about a macro in ASM, callable from 'C'? | 01/01/70 00:00 | |
This is HOW I will Prefer | 01/01/70 00:00 | |
LST output of my previously posted code | 01/01/70 00:00 | |
Try the comparison | 01/01/70 00:00 | |
Unnecessarily complicated! | 01/01/70 00:00 | |
NOT UNNECESSARILY | 01/01/70 00:00 | |
You are mistaken | 01/01/70 00:00 | |
Array or pointer similar | 01/01/70 00:00 | |
That should not be necessary | 01/01/70 00:00 | |
SFRX(...,. ..) worked | 01/01/70 00:00 | |
SFRX - presumably, that's an SDCC extension? | 01/01/70 00:00 | |
Found it! | 01/01/70 00:00 | |
RE: Found it!![]() | 01/01/70 00:00 |