next up previous contents
Next: Tools Up: Memory and I/O Organization Previous: Address versus contents   Contents

Memory and I/O

Memory refers to the memory chips inside a computer. As useful as memory is, it is still internal to a computer. In other words, memory only enables a computer to remember. Memory does not let a computer know what is happening in the real world.

In other words, if computers were only equipped with memory, pressing on the keyboard and clicking a mouse would not do anything. Similarly, there is no way for a computer to output information to the screen or printer.

In order to input and output information to and from a computer, certain addressable locations, called I/O locations, are needed. I/O locations are similar to memory locations because a program can read from and write to such locations.

However, writing to an I/O location does not mean the written value is memorized. Instead, some signal external to the computer is altered. Simiarly, reading from an I/O location does not mean reading a previously remember value. Instead, some signal external to the computer is read.

For example, reading from an particular I/O location reads back which key is pressed on a connected keyboard. In general, some external device is responsible for specifying the value when an I/O location is read. An example of writing is writing to a sound card I/O location. Instead of having the written value remembered, the soundcard translates the value to the amplitude of voltage sent to speakers, resulting in sound that a user can hear. In general, some external device should listen to some external signal when and a program writes to an I/O location.

As mentioned earlier, I/O locations and memory locations share some simlarities. Not only can a program write to and read from I/O locations, but it must also specify which I/O location to access. This is because a computer generally has many I/O locations, and a program is only interested in accessing one I/O location at a time. The collection of all I/O locations forms an ``I/O space''.

In some computers, most notably PCs, I/O locations do not share the same ``space'' as regular memory. This means there is a location zero for memory, and there is a different location zero for I/O locations. One instruction is used to access memory location zero, a different instruction is used to access I/O location zero. Writing to memory location zero is completely different from writing to I/O location zero. This approach is often called ``I/O mapped'' because there is a separate ``map'' for I/O locations.

In other computers, such as the AVR architecture that we will use, I/O locations and memory location share the same space. In the case of the AVR, locations 32 to 95 are designated as I/O locations, while locations 96 to 608 are memory locations. The same instruction (with different operands, see later discussion of instructions) is used to access location 32 (the first I/O location) and location 97 (the second memory location). This approach is often called ``memory mapped'' because I/O shares the same map used for memory.


next up previous contents
Next: Tools Up: Memory and I/O Organization Previous: Address versus contents   Contents
Tak Auyeung 2003-11-10