18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

14-1 for longer delays between writes. To do so, between lines 30 and 40, add this or a<br />

similar “do-nothing” loop: FOR J=1 to 10:NEXT J.<br />

For EPROM storage, you can copy the ROM into RAM and then use Listing 13-8 to program<br />

an EPROM. For this method, use a 32K RAM at U7 in Figure 3-1. You’ll also need an<br />

unprogrammed 8K EPROM accessed as data or code/data memory. Set MTOP to 5FFFh or<br />

lower to ensure that BASIC-52 won’t overwrite the area from 6000h to 7FFFh. In Listing<br />

14-1, lines 10, 30, and 80, change 8000h to 6000h. Run the revised program to copy the<br />

8052-BASIC’s ROM into RAM at 6000h-7FFFh. You then can upload or enter Listing 13-8<br />

to copy BASIC-52 into your EPROM, at the starting address you specify.<br />

Another option is to use an EPROM programmer to copy BASIC-52. If your programmer<br />

has an adapter for 8051s, you can copy the 8052-BASIC’s ROM directly into the programmer’s<br />

buffer and then program an EPROM, EEPROM, or NV RAM with the buffer’s<br />

contents. If you don’t have an adapter, you can use the technique described above to copy<br />

BASIC-52 into NV RAM or EEPROM, and then read the device into your programmer.<br />

To read a DS1225 into an EPROM programmer’s buffer, configure the programmer for a<br />

DS1225 or 2764 EPROM, since the pinouts for reading these devices are the same. Place<br />

the DS1225 in the programming socket and read the contents into the programmer’s buffer.<br />

Be sure not to subject the DS1225 to any EPROM programming voltages (by trying to<br />

program the device as an EPROM, for example), since this could be lethal to it.<br />

After reading the DS1225, insert a 2764 EPROM into the programming socket, and program<br />

the EPROM with the buffer’s contents. You now have an EPROM with the same contents<br />

as your NV RAM.<br />

System Requirements<br />

Running BASIC-52 from External Memory<br />

To run BASIC-52 from external memory, your circuit must include the following:<br />

• Any 8052, 8032, 80C52, or 80C32 chip, with pin 31 tied low.<br />

• BASIC-52 stored in non-volatile memory (NVRAM, EEPROM, or EPROM),<br />

beginning at 0 in code memory.<br />

• At least 1K of read/write memory (RAM), beginning at 0 in data memory (required for<br />

all BASIC-52 systems).<br />

• For permanent storage of BASIC-52 programs, non-volatile memory beginning at<br />

8000h in data or code/data memory.<br />

One limitation to running BASIC-52 from external memory is that you can’t use PROG,<br />

FPROG, or PGM. This is because during programming, BASIC-52 accesses the address bus<br />

as ports, but when BASIC-52 runs from external memory, the 8032 needs the address bus<br />

<strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong> 241

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!