Interfacing with external devices

Examples    Exercises    Solutions    Errata corrige

4.1 Managing communication with external devices

4.1.1 The unidirectional handshake

Example of a parallel interface with a unidirectional handshake



TX + RX:

4.1.2 The bidirectional handshake

Example of a parallel interface with a bidirectional handshake



TX + RX:


4.2 Hardware-supported handshake

4.2.1 Example of a parallel interface with hardware handshake

Programming the parallel interface with handshake hardware

TX (program):

RX (program):


4.3 Polling

TX (program):

RX (program):

   Complete system (this figure is not present in the book):


4.4 Interrupt techniques

4.4.3 Example of an interface with an interrupt request



   Complete system:


4.5 Using vectored interrupts

4.5.3 Example of handling vectored interrupts

  Here the trace of code presented in the text:


4.6 Interrupt timers

4.6.2 Example of a timer interrupt: blinking lights

  First version (1 mS):

  Second version (1 second):

4.7 Examples of programming and interfacing

4.7.1 Pulse generator (at system reset)

4.7.2 Finite State Machines

  First solution:

  Second solution:

4.7.3 Sinusoidal waveform generator

4.7.4 Dual sinusoidal waveform generator

4.7.5 Object counters

4.7.6 Sensor evaluation in parallel

4.7.7 Push-button interface for a video game

4.7.8 Asynchronous serial communication



ASTX Component

ASRX Component

TX Controller

RX Controller


4.8 Exercises

A click on the icon shown on the left will open a trace of the program to be written in the Deeds-McE. Instead, with a click on the schematic on the right, when present, it is possible to open in the Deeds-DcS a microprocessor system ready to be loaded with the program to test. It will be useful to verify its behavior by simulation (by animation or in the timing diagram). When applicable, a test sequence is already set up in the timing diagram window and will be loaded automatically.

4.8.1 Interrupt techniques

Exercise 1:

Exercise 2:

Exercise 3:

Exercise 4:

Exercise 5:

Exercise 6:

Exercise 7:

Exercise 8:

For the ASRX component, see the section: Asynchronous serial communication.

4.9 Solutions

A click on the icon on the left allows you to open the solution described in the text in the Deeds-McE. By clicking on the schematic on the right, it is possible to open the microprocessor system in the Deeds-Dcs with the same program already set up to simulate its behavior.

4.9.1 Interrupt techniques

Solution of exercise 1:

Solution of exercise 2:

Solution of exercise 3:

Solution of exercise 4:

Solution of exercise 5:

Solution of exercise 6:

Solution of exercise 7:

Solution of exercise 8:

4. Errata Corrige (Chapter 4)