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.

Chapter 4<br />

If BASIC-52 is unable to program the chip, you’ll see this:<br />

ERROR: PROGRAMMING<br />

If you get this error message, double-check your wiring. When the programming command<br />

executes, pins 20, 22, and 27 should toggle, along with the address and data lines.<br />

Running a Stored Program<br />

When you have a program saved, you can run it from the NV memory. BASIC-52’s RAM<br />

and ROM commands switch from RAM mode, where BASIC-52 runs the program stored<br />

in RAM (U7), to ROM mode, where it looks in U8 for programs to run. When you’ve<br />

programmed successfully, run your program by typing<br />

ROM<br />

RUN<br />

or<br />

RROM<br />

You can store multiple programs, space permitting, and run each by specifying its number.<br />

For example, to run the second program stored, type<br />

RROM2<br />

To return to editing programs in RAM, type<br />

RAM<br />

Another useful command is XFER. In ROM mode, type<br />

XFER<br />

to copy the current program from ROM into RAM, where you can edit it, and then use<br />

FPROG to store the revised version in U8 if you wish.<br />

Adding Bootup Options<br />

<strong>The</strong> commands FPROG1-FPROG6 enable you to store additional information besides<br />

programs. FPROG1 saves the current baud rate and causes BASIC-52 to boot immediately<br />

to the READY prompt, without waiting to receive a SPACE character. FPROG2 saves the<br />

current baud rate and also tells BASIC-52 to automatically run the first program in NV<br />

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

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

Saved successfully!

Ooh no, something went wrong!