Hardware Reference
In-Depth Information
11.10 Exercises
E11.1 Does the I 2 C clock frequency need to be exactly equal to 100 or 400 kHz? Why?
E11.2 Suppose that the 7-bit address of an I 2 C slave is B'10101 A1 A0' with A1 tied to low and
A0 pulled to high. What is the 8-bit hex write address for this device? What is the 8-bit hex
read address?
E11.3 Assuming that the HCS12 is running with a 16-MHz E-clock, compute the values to
be written into the IBFD register to set the baud rate to 100 and 200 kHz. Use Table 11.6.
E11.4 Assuming that the HCS12 is running with a 32-MHz E-clock, compute the values to
be written into the IBFD register to set the baud rate to 200 and 400 kHz. Use Table 11.6.
E11.5 Write a function to set the TL value to the DS1631A in the assembly and C languages.
E11.6 Write a instruction sequence to call the openDS1631 function to configure the
DS1631A to operate in one-shot mode, 10-bit resolution, and low active polarity for T OUT
output.
E11.7 Assuming that the DS1631A has been confi gured to operate in one-shot mode with
12-bit resolution, write a program to display the converted temperature in the format of
three integer digits and one fractional digit in LCD.
E11.8 For the circuit shown in Figure 11.34, add an alarm speaker to the PWM1 output and
set the high-temperature trip point to 50
°
C. Whenever temperature reaches 50
°
C or higher,
turn on the alarm until the temperature drops down to 23
C.
E11.9 Write an assembly routine to implement the algorithm described in Figure 11.39.
E11.10 The MAX5812 is a DAC with 12-bit resolution and I 2 C interface. The MAX5821 data
sheet can be downloaded from the website http://www.maxim-ic.com. What is the 7-bit address
of this device? What is the highest operating frequency of this chip? How many commands are
available to this chip? How is this device connected to the I 2 C bus?
E11.11 For the MAX5812 mentioned in E11.10, write a program to generate a sine wave
from the OUT pin.
E11.12 The MCP23016 is an I/O expander from Microchip. This chip has an I 2 C interface
and can add 16 I/O pins to the microcontroller. Download the data sheet of this device
from Microchip's website. Show the circuit connection of this chip to the microcontroller,
and write a sequence of instructions to configure the GP1.0, . . . , GP1.7 pins for input and
configure the GP0.0, . . . , GP0.7 pins for output. Configure input polarity to active low.
E11.13 What are the corresponding temperatures for the conversion results 0x6800, 0x7200,
0x4800, 0xEE60, and 0xF280 output by the DS1631A? Assume that the 12-bit resolution is
used.
E11.14 What will be the conversion results sent out by the DS1631A for the temperature
values 40°C, 50°C, 80.5°C, 210.25°C, and 220.5°C? Assume that the 12-bit resolution is
used.
E11.15 Write a function that performs a block read from the 24LC08B. The control byte, the
starting address to be read, and the number of bytes to be read are passed in A, B, and Y, re-
spectively. Return the error code in B and store the returned data in a buffer pointed to by X.
This function should check the error of no acknowledgement.
E11.16 Write a function that performs a current address read to the 24LC08B. Pass the con-
trol byte in A to this subroutine. Return the data byte and error code in A and B, respectively.
This function should check the error that the 24LC08B did not acknowledge.
°
 
 
Search WWH ::




Custom Search