??? 04/08/09 07:52 Read: times |
#164478 - NOT UNNECESSARILY Responding to: ???'s previous message |
Dear Andy,
You have a good point. From the snippet I posted it seems UnNecessary. But infact (if I will develope this system) this file will be only 1 module of my program. The pointer in snippet will be declared as extern in other modules & the IC will be accessed through this pointer The init_8255() will be called during initialisation of system only. Also it will have following hashdefines in header file #define PORT_A 0 #define PORT_B 1 #define PORT_C 2 #define CWR 3 values will be written/read as *(ptr_8255 + PORT_B) = my_val; //writing to portB port_val = *(ptr_8255 + PORT_A); //reading portA Benifit of which is, other modules may not need to know actual address of 8255. Also I dont need to write routine such as unsigned char read_porta(void) or void write_to_portb(unsigned char val) Another programmer can also access 8255 without knowing its memory mapped address(if I devide project into parts done by me and my collegue) Ofcourse, we will have to take care that value of ptr_8255 is not changed anywhere in program Regards, Mahesh |
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 |