??? 08/12/04 08:58 Read: times |
#75799 - RE: Using Port2 for RAM & I/O simultaneously Responding to: ???'s previous message |
Generally, you should avoid it. If your hardware uses external memory access then it is not so hard to implement extra input/output ports as memory mapped ports. Well i think this is the best part of the message. If you can have a few logic gates just use that and a latch to have a full port, this will be just so much pain avoided in the code that you might even gain. if this is sram, it is possibly to store user values, (i hope you are using a 8051 derivative with onboard ram & rom) , then you could maybe "bitbang the memory acess, using function 2) using read-modify-write instructions and Ri instead DPTR, something like: CLR P2.7 SETB P2.5 ; ... ANL P2,#11111000b ; mask address bits ORL P2,#HIGH(MEM_ADDR) ; prepare high byte of address MOV R0,#LOW(MEM_ADDR) ; load low byte of address MOVX A@,R0 i would personally replace the ORL P2,#high(MEM_ADDR) by MOV Ri, #high(MEM_ADDR) ANL Ri, #00000111 ORL P2, Ri or any corresponding code (I m no 8051 asm specialist) to avoid the modification of output bits if a wrong address is provided (maybe is it useless, code should be perfect ;-)) |
Topic | Author | Date |
Using Port2 for RAM & I/O simultaneously | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneously | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneously | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneously | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneously | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneously | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneously | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneo | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneo | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneo | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneo | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneo | 01/01/70 00:00 | |
RE: Using Port2 for RAM & I/O simultaneo![]() | 01/01/70 00:00 | |
Only as an input? | 01/01/70 00:00 | |
RE: Only as an input? | 01/01/70 00:00 | |
RE: Only as an input? | 01/01/70 00:00 | |
RE: Only as an input? | 01/01/70 00:00 |