Confirming Pages
310 CHAPTER 7 Microcontroller Programming and Interfacing
in Design Example 7.2. Lab Exercise 11 also shows the procedure applied to an
example.
1 . Define the problem. State the problem in words to explain the desired func-
tionality of the device (i.e., what is the device supposed to do?).
2. Draw a functional diagram Draw a block diagram that illustrates all of
the major components of the design and shows how they are interconnected.
Each component can be shown as a square with a descriptive label inside or,
preferably, as a pictorial representation (e.g., a clipart image or photograph).
Use single lines to connect the components (regardless of the number of wires
involved), and include arrowheads to indicate the direction of signal flow.
3. Identify I/O requirements. List the types of inputs and outputs required and
what functions need to be performed by the microcontroller. You need to iden-
tify the number of each type of I/O line you require, including digital inputs,
digital outputs, A/D converters, D/A converters, and serial ports.
4. Select appropriate microcontroller models. Based on the types and number
of inputs and outputs identified in the previous step, choose one or more micro-
controllers that have sufficient on-chip resources. Another factor that influences
this choice is the anticipated amount of program and data memory required.
If the program is very complex and the application requires significant data
storage, then choose a microcontroller with ample memory capacity. If multiple
PICs are required (due to I/O and/or memory constraints), the PICs can
communicate with each other through I/O lines by using simple handshaking
(e.g., wait for a signal from another PIC to go high before doing something and
then send another signal back when done) or PicBasic Pro’s Serout and Serin
statements for serial communication (e.g., to share data between the PICs).
Refer to manufacturer literature for a list of available models and capacities.
Information for Microchip’s entire line of PIC microcontroller products can be
found online (see Internet link 7.10, which points to the line of reprogrammable
flash-memory microcontrollers listed at www.microchip.com ).
5. Identify necessary interface circuits. Refer to the microcontroller input and
output circuit specifications and use the information in Section 7.8 to design
appropriate interface circuitry utilizing pull-up resistors, buffers, transistors,
relays, and amplifiers where required. Also, in cases that require many digital
I/O lines, where the PIC(s) selected do not provide enough I/O pins, there are
ways to interface to a large number of lines with a smaller set of pins. One
approach is to use shift registers (e.g., the 74164, 74594, or 74595 for output,
and the 74165 or 74597 for input), where a small set of PIC I/O pins (two for
the nonlatched type and three for the latched type) can be used to transmit
bits serially to or from an 8-bit register, providing eight lines of I/O. Another
alternative when expanding your I/O capability is to use a device providing
multiplexed programmable I/O ports (e.g., the Intel 82C55A programmable
peripheral interface, or PPI). This type of device allows one I/O port to switch
access among several I/O ports. With Intel’s 82C55A, 5 control lines and 8
data lines provide access to 24 lines of general purpose, user-configurable I/O.
Internet Lin
7.10Microchip
PIC flash product
line
alc80237_ch07_258-345.indd 310alc80237_ch07_258-345.indd 310 12/01/11 12:52 PM12/01/11 12:52 PM