I did go through the above sites, but I would like to understand more on this and create a simple schematic on how to wire the 8051, 74138, RAM, ROM and I/O.
I would also like to know how to draw up the memory map as to the address space in which the ROM is mapped, RAM, I/O etc.
I did download the "Final Word On The 8051", but this does not detail the use of the 74138. I am actually looking for help on what should be connected where and where the devices would exist on the memory map. That too if I decide to use 64K RAM, 64K ROM and 32 bytes I/O.
Senthil
I would appreciate if you let me know more on this .
jo2moon
I am actually going to use a 8052 and ignore the internal ROM.
OK the 74138 is a 3 -> 8 decoder **broken link removed**
When you look at the datasheet you should see its function easily:
One of the 8 outputs O0 to O7 is low corresponding to the 3 inputs A0 to A2 while E1, E2 and E3 have their desired states.
So if you use an 8051 and connect for example A13, A14, A15 to A0, A1, A2 of the 74138 and connect E1 and E2 to GND and E3 to +5V (also on the 74138) you should get the following adress ranges useing O0 to O7 as CS for your external devices:
O0 L from 0x0000 to 0x1FFF
O1 L from 0x2000 to 0x3FFF
O2 L from 0x4000 to 0x5FFF
O3 L from 0x6000 to 0x7FFF
O4 L from 0x8000 to 0x9FFF
O5 L from 0xA000 to 0xBFFF
O6 L from 0xC000 to 0xDFFF
O7 L from 0xE000 to 0xFFFF
Just a short note on the 8051 the code and dataspace are separated, to seperate them using everything "external" you also need to use the RD and WR pins but this is another story which you should find in "the final word" ...
I am also fully into the "Final Word..." and have the following doubts now
The 74138 would provide chip selects for the following ranges
O0 L from 0x0000 to 0x1FFF
O1 L from 0x2000 to 0x3FFF
O2 L from 0x4000 to 0x5FFF
O3 L from 0x6000 to 0x7FFF
O4 L from 0x8000 to 0x9FFF
O5 L from 0xA000 to 0xBFFF
O6 L from 0xC000 to 0xDFFF
O7 L from 0xE000 to 0xFFFF
But I observe that these are all 8192 (8K) spaces only, so a single ROM or RAM device greater than 8K can not used with these chip selects.
Am I right here ? I understand from the "Final word.." that 64 K of ROM can be used from 0x0000 to 0xFFFF using the 8051 ALE as the chip select, but if I also want to use a 64K RAM then how could I derive the chip select ? Can I use the the RD or WR for this ?
I could add the I/O using the 74138 as I need only a few addresses.
TIA
For useing a 64 KRam you would have to use an and gate which is connected to RD and WR so if either RD or WR ist L the output gets L
I have used a 74139 in the past which is 2 seperate 2 to 4 decoders similiar to the 74138 and gave me a little bit more flexibility in decoding for my Ram, Rom and peripherals.
I am also afraid if you really need 64K ram and 64K rom for your application the 8051 maybe not the right processor to do this, but this is again just my personal opinion.
You could also use a Philips 89C51RD2 processor which already has 64K codespace internal so you would not need an external EEPROM or Flash for your program, but if you need an external ram this does not simplify your hardware very much.
If you need bigger adress segments than 8k with the described 74138 simply connect only A15 (will give 2 32K segments) or A15 and A14 (will give 4 16K segments).
The "Final Word..." was a great reference. Many things make sense to me now along with the valuable tips you have given me.
You are right about the choice of the 8051, but I would be changing to a 8051 based SoC after some time. Till then I would be using exernal RAM and ROM.