Real-Time Systems Development

Chapter 3: Basic Input and Output

3.1 Chapter overview

Dealing with input/output (I/O) activity can be the central challenge for many real-time programmers because routine desktop computing successfully hides its complexity, structure and dynamics. This chapter suggests that real-time programmers often need a good understanding of the underlying hardware, in terms of port address mapping and register functionality. Interrupt processing introduces further complexity for the programmer, including critical data protection and relative timing issues.

3.2 Memory-mapped ports

For the programmer, accessing hardware usually means reading or writing to ports or registers belonging to a peripheral device. The instructions used for such activity depend on the addressing scheme adopted by the system designer. With memory-mapped ports, the I/O registers behave like memory locations, responding to the same main bus control signals as RAM and ROM chips. Thus, programmers can access memory-mapped ports using standard variable access instructions, such as indata = *portpointer;. The compiler translates this code using machine instructions such as MOVE, which are also used to access memory. The peripheral devices are allocated addresses within some part of the memory map. Generally all the ports are clustered together so as not to fragment the physical memory, rendering it less usable for contiguous blocks of RAM or ROM.


Memory-mapped I/O, showing the address decoding for a 24 bit CPU

The I/O chip in the figure opposite is memory-mapped and positioned within a 16 Mbyte address space. It contains four registers (Status, Command, Data-in and Data-out) and so only requires two address lines for internal...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Microcontrollers (MCU)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.