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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Jumper J4 is optional. It enables you to write-protect U8 by jumpering WE to +5V. You might<br />

want to do this if you have critical programs or data stored in U8, and you want to be sure<br />

that you don’t overwrite them accidentally.<br />

Wiring Tips<br />

When you add the circuits for NV memory, use sockets for U8 and U9. If you previously<br />

tied unused pins 9 and 10 of U3 to ground or +5V, be sure to remove these connections<br />

before you wire the ones shown in Figure 4-3. Since pins 4, 5, 9, 10, 12, and 13 of U9 are<br />

unused CMOS inputs, you should wire these to +5V or ground. You may instead use a<br />

74LS32 for U9. If you do so, leave the unused inputs open.<br />

Using the Programming Commands<br />

When Figure 4-3’s circuit is added, you’re ready to power up and try the programming<br />

commands. Begin by entering any simple BASIC-52 program, such as one of the examples<br />

in Chapter 3.<br />

Setting MTOP<br />

If you have a 32K RAM at U7, you have an additional step to perform before you store a<br />

program in U8. On bootup, BASIC-52 tests contiguous memory and sets MTOP to the<br />

highest value it finds below E000h. But BASIC-52’s programming commands won’t work<br />

unless MTOP is below 8000h. To enable program storage, type the following command:<br />

MTOP=7FFFh<br />

This ensures that BASIC-52 won’t try to store RAM programs, variables, or strings in the<br />

area that you’ve reserved for permanent program storage (although it doesn’t prevent you<br />

from writing to the area with BASIC-52’s XBY operator). If U7 is an 8K device, MTOP is<br />

1FFFh, well below 8000h, so you don’t have to worry about changing it.<br />

Saving a Program<br />

To copy the current program from U7 to U8, type<br />

FPROG<br />

Saving Programs<br />

<strong>The</strong> screen will display the number 1, indicating that this is the first BASIC-52 program to<br />

be stored in the device, and after a short delay, the READY prompt should return.<br />

PROG is an alternate command that uses a slower programming algorithm, and should also<br />

work.<br />

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

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

Saved successfully!

Ooh no, something went wrong!