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.

Unassigned space remains in the memory map, but there’s nothing wrong with this since it<br />

leaves room for additions. Also, this isn’t the only way to configure an 8052-BASIC system.<br />

For example, if you use a single 8K EPROM at 8000h, you can use the area from A000h to<br />

BFFFh for additional I/O.<br />

Not shown are two areas that BASIC-52 reserves for optional enhancements. If you<br />

customize BASIC-52 by adding your own instructions, commands, or reset routines,<br />

BASIC-52 expects to find parameters relating to these in code memory from 2001h to 2090h.<br />

And, if you want to call assembly-language interrupt routines, BASIC-52 expects to find<br />

vectors for these in code memory from 4003h to 41FFh. For these, you can use EPROM,<br />

EEPROM, or NV RAM, as Chapter 13 shows.<br />

Uses for I/O Ports<br />

Inputs and Outputs<br />

Just about all microcontroller circuits need to be able to do more than just read and write to<br />

memory. Other uses involve sensing and controlling of conditions, events, or devices<br />

external to the basic circuits. For example, a microcontroller-based drilling machine for<br />

printed-circuit boards might have these responsibilities:<br />

Detect when a user presses a switch.<br />

Move the pc board so that the hole to be drilled lies under the drill bit.<br />

Set the speed of rotation for the drill bit.<br />

Lower the bit into the board, then raise it after drilling.<br />

Detect problems, such as a bit that doesn’t lower or a drilling obstruction.<br />

Display messages to prompt the user for input or show progress.<br />

<strong>The</strong>se functions all involve reading and writing, but instead of reading and writing to<br />

memory, the microcontroller reads sensors and switches, and writes to motors and displays.<br />

Reading and writing to devices other than memory is often called input/output, or I/O for<br />

short.<br />

Adding Ports<br />

<strong>The</strong> 8052-BASIC has a few pins on Port 1 that you can use for I/O. Chapter 3 included<br />

programs for reading and writing to these. But many projects will require more I/O than<br />

these few pins can offer.<br />

Figure 6-2 shows a circuit that allows you to add up to eight 8-bit ports to the main circuit.<br />

You can design the ports as inputs or outputs, in any combination.<br />

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

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

Saved successfully!

Ooh no, something went wrong!