Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/10/01 19:30
Read: times


 
#9188 - RE: Address decoding for AT89C52
Andy Yeong wrote:
-------------------------------
Do you mean just before the program reached 1FFFh, you need to issue an instruction to branch to 8000h and continue executing from there ?

- - - - - - - - - - - - - - - -
In theory you're on the right idea though in practice such a jump is not often required. Often the code is separated into logical blocks so that the transition is made between the internal and external accessed code by subroutine calls or jumps.

Note the tradeoffs. External code is accessed slower than internal code because the MOVX command extends the ALE cycle to give external memory more time to respond and drive its information onto the bus. No extra time is required for the internal block because the microcontroller designers had the advantage of planning those two circuits to work together nicely. External memory has to work with various possible devices and so the tradeoff is made.

When you plan what routines you place into each block, consider the advantages of the internal block for speedy processing and that calls and jumps within the same block are most efficient because short jumps and call op codes can be used.

You also need to know how to separate the two blocks so you can program the microcontrollers FLASH 8K block and also the the additional code into the external EPROM programmer.

Critical code like background interrupts, or secret algorithms you wish to hide from competitors seeking to easily copy them, would be best placed in internal code space. The external EPROM could easily be removed and copied.

If you are writing in C (which the code space might suggest) someone else will have to advise you here on methods to specify the code blocks.


Andy Yeong wrote:
-------------------------------
When the controller is executing instructions from 0000h - 1FFFh, what's the state of A15 since it's running on internal flash ?

- - - - - - - - - - - - - - - -
At reset, all 8051 outputs go to HIGH or ONE state. You'll be accessing the external program block in 16 bit mode.

A word of warning: I use a powerful version of the 8051 and so some aspects of my 8051 may not be available or act the same way as yours. Tell us the part number and always confirm advice through your own documentation before proceeding.

Usually its good form not to select a chip when its not in use, but as long as you don't enable two at the same time, its ok. Since this EPROM is the only external chip, you could leave it chip enabled all the time and use the PSEN (and maybe RD) as the controls to activate the transfers. For internal program accesses, the PSEN, RD and WR shouldn't activate (check your part number to be sure). If you plan to access the EPROM with a MOVX instruction, you might need to logically combine the PSEN and RD command that the chip receives.

TRUTH IS: You can use the behavior of the external accesses to load the 32K chip in the LOWER page. Assuming you only connect the required EPROM address lines and leave the EPROM chip enabled tied active low, then it will behave as follows. Program accesses to 0000-1FFF will go to internal FLASH and the external PSEN/, RD/ and WR/ won't be active. for addresses 2000-7FFF the microprocessor will present the addresses and controls to the external chip... no surprise there. Here's the trick. When the code attempts to access 8000-9FFF the microcontroller will present the address and command signals just like you had it mapped there. However, since you aren't using A15 since its only a 32K EPROM, and since the EPROM chip enable is always tied active low, the state of A15 is ignored and the EPROM interprets the request for 8000-9FFF *AS* 0000-1FFF in the EPROM.

Under that scheme, the only trick you have to be mindful of is the complicated nature of programming your EPROM. You need to put the 8000-9FFF portion of your code into the 0000=1FFF page of the EPROM.

Personally, I'd recommend using a micro with more FLASH and don't waste the external pins. The Temic/Atmel 89C51RD2 has 64K of internal FLASH memory. Philips has an 89C51RC2 for 32K and RD2 for 64K. The TEMIC part is superior and includes some EEPROM space for nonvolatile storage. They cost about the same but TEMIC saves you a basic EPROM and their code security, and fast clocking options are better than Philips.

Someone else with actual experience with a system like yours will hopefully post their experience of how to make it easier to work.

Good Luck,

aka j

http://www.geocities.com/mingpzong

List of 11 messages in thread
TopicAuthorDate
Address decoding for AT89C52            01/01/70 00:00      
RE: Address decoding for AT89C52            01/01/70 00:00      
RE: Address decoding for AT89C52            01/01/70 00:00      
RE: Address decoding for AT89C52            01/01/70 00:00      
RE: Address decoding for AT89C52            01/01/70 00:00      
RE: Address decoding for AT89C52            01/01/70 00:00      
RE: Address decoding for AT89C52            01/01/70 00:00      
RE: Address decoding for AT89C52            01/01/70 00:00      
RE: Peter            01/01/70 00:00      
RE: Address decoding for AT89C52            01/01/70 00:00      
RE: George, Andy            01/01/70 00:00      

Back to Subject List