Professional Documents
Culture Documents
Internal Test-Unit-3 Answers
Internal Test-Unit-3 Answers
Ans:
Ans:
• The DAC converts binary numbers into their equivalent analog voltages.
• The DAC finds applications in areas like digitally controlled gain, motor speed controls,
programmable gain amplifiers, etc.
• The DAC 0800 is a monolithic 8-bit DAC manufactured by National semiconductor
• It has settling time around 100ms and can operate on a range of power supply voltages,
i.e. from 4.5 v to +18 v. Usually V+ is 5v or +12 v
• Write an ALP to generate a triangular wave of frequency 500 Hz using the interfacing
circuit shown below. The 8086 system operates at 8MHz. The amplitude of the triangular
wave is +5V ,
• Assuming the wave to be generated symmetric, the waveform will rise for 1 ms and fall
for 1 ms. This will be repeated continuously.
2. a) Explain in detail about the DMA controller with a neat diagram.
Ans:
Key Features:
3. 24-bit length address register
4. 16-bit length count register
5. 4 independent DMA channels
6. 4 clock / 1 bus cycle
7. Byte transfer / word transfer selectable
8. Supports three transfer modes (Single, Demand, Block)
9. DMA request Maskable on an individual channel basis
10. Software DMA request in uPD1037 mode
11. Auto initialization function
12. Two kinds of channel priority order (Fixed & Rotating)
13. Cascading capability
8237 Internal Registers
CAR
The current address register holds a 16-bit memory address used for the DMA transfer.
Each channel has its own current address register for this purpose
When a byte of data is transferred during a DMA operation, CAR is either incremented
or decremented. depending on how it is programmed
CWCR
The current word count register programs a channel for the number of bytes to transferred
during a DMA action.
CR
The command register programs the operation of the 8237 DMA controller.
The register uses bit position 0 to select the memory-to-memory DMA transfer mode.
1. Memory-to-memory DMA transfers use DMA channel
2. DMA channel 0 to hold the source address
3. DMA channel 1 holds the destination address
BA and BWC
The base address (BA) and base word count (BWC) registers are used when auto-
initialization is selected for a channel.
In auto-initialization mode, these registers are used to reload the CAR and CWCR after
the DMA action is completed.
MR
The mode register programs the mode of operation for a channel.
Each channel has its own mode register as selected by bit positions 1 and 0.
1. Remaining bits of the mode register select operation, auto-initialization,
increment/decrement, and mode for the channel
BR
The bus request register is used to request a DMA transfer via software.
1. very useful in memory-to-memory transfers, where an external signal is not
available to begin the DMA transfer
MRSR
The mask register set/reset sets or clears the channel mask.
1. If the mask is set, the channel is disabled
2. The RESET signal sets all channel masks to disable them
MSR
The mask register clears or sets all of the masks with one command instead of individual
channels, as with the MRSR.
SR
The status register shows status of each DMA channel. The TC bits indicate if the
channel has reached its terminal count (transferred all its bytes).
When the terminal count is reached, the DMA transfer is terminated for most modes
of operation.
The request bits indicate whether the DREQ input for a given channel is active.
b) Draw a typical stepper motor interface with 8255 and explain its functioning.
Ans:
• A stepper motor is a device used to obtain an accurate position control of rotating shafts
• It employs rotation of its shaft in terms of steps rather than continuous rotation as in case
of AC or DC motors
• To rotate the shaft of the stepper motor, a sequence of pulses is applied to the windings
of the stepper motor in a proper sequence
• The number of pulses required for one complete rotation of the shaft of the stepper motor
is equal to its number of internal teeth on the rotor
• The stator teeth and the rotor teeth lock with each other to fix a position of the shaft.
• With a pulse applied to the winding input, the rotor rotates by one tooth position or an
angle x
• After the rotation of the shaft through angle x, the rotor locks itself with the next tooth in
the sequence on the internal surface of stator
• Fig below shows the internal schematic of a four winding stepper motor. Stepper motors
have been designed to work with digital circuits. Binary level pulses of 0-5v are required
at its winding inputs to obtain the rotation of shafts
The sequence of pulses can be decided, depending upon the required motion of the shaft
• The circuit for interfacing Wn with an I/O port is shown in the fig. Each of the windings
of a stepper motor need this circuit for its interfacing with the output port
• A typical stepper motor may have parameters like torque 3kg-cm, operating voltage 12
V, current rating 0.2 A and a step angle 1.8 0, i.e., 200 steps/revolution (number of rotor
teeth)
• A simple scheme for rotating the shaft of a stepper motor is called a wave scheme
• In this scheme, windings Wa, Wb, Wc, and Wd are applied with the required voltage
pulses, in a cyclic fashion.
• By reversing the sequence of excitation, the direction of rotation of the stepper motor
shaft may be reversed. Table below shows the excitation sequences for clockwise and
anticlockwise rotations.
3. a) Explain the BSR mode of operation of 8255 programmable peripheral interface.
The (D3, D2, D1) will be 000 to 111. In this mode it affects only one bit of Port C at a time.
When user set the bit, it remains set until user unset it. The user needs to load the bit pattern in
control register to change the bit.
Input/ Output Mode
This mode is selected when the D7 bit of the control register is 1.
This mode has also three different modes. These modes are Mode 0 and Mode 1 and Mode 3.
Bits Function
D6 & These are used to set port A mode. for 00, it is m0 mode, for 01, it is m2 mode and 10 or
D5 11, it is m2 mode.
D3 1 when higher nibble of port C is taking input, and 0 when higher nibble is sending
output.
D0 1 when lower nibble of port C is taking input and 0 when lower nibble is sending output.
Ans:
Assume selected counter is Counter-1, Mode for Square wave is Mode-3, Address for Counter 1
is 82H
4. a) Interfacing of a two 4X4 PROM and two 8X4 RAM with 8086 CPU, draw the memory
map and interfacing diagram for it, the RAM address follows the ROM address.
Solution:
The address of the RAM may be selected anywhere in the 1 MB address space of 8086,
but to make the address space continuous we would follow the given procedure.
After reset the IP and CS are initialized to for address FFFF0H.
We must first calculate the total number of address lines required for 8K bytes of
EPROM which is 13, as we have seen earlier that we have N2n hence we get 213= 8K
Decoded Map
Address lines A13-A19 are used for decoding to generate the chip select.
The BHE signal goes low when a transfer is at odd address or higher byte of data is to be
accessed.
The A0 and A1 pins of 8255 are connected to A1 and A2 pins of the microprocessor
respectively. We will use absolute decoding scheme that uses all the 16 address lines.
For deriving the device address pulse. Out of A0– A15 lines, two address lines A2 and
A1 are directly required by 8255 for three port and CWR address decoding. Hence only
A3 to A15 are used for decoding addresses.
Circuit diagram, the 8086 is assumed to be in the maximum mode so that IORD and I
OWR are readily available.
b) What is DMA? What are its advantages?
Ans:
DMA controller definition is, an external device that is used to control the data transfer
between memory and I/O device without the processor involvement is known DMA
controller.
This controller has the capacity to access the memory directly to read or write operations.
DMA controller was implemented by Intel for having very fast data transfer with less
utilization of the processor.
The direct memory access controller produces memory addresses and it covers numerous
hardware registers that can be read & written through the CPU.
These registers mainly include a byte count, memory address & minimum of one or
above control registers.
So based on the DMA controller features, these registers can select some combination of
source, destination, transfer direction, the transfer unit size & the number of bytes to
move within the single burst.
It allows a peripheral device to read or write from memory without using the CPU.
DMA controller increases the operations of the memory by avoiding CPU involvement.
It reduces the overload work on the CPU.
For every transfer, simply a few clock cycles are necessary.
DMA decreases the required clock cycle to read/write a block of data.
The disadvantages of the DMA controller include the following.
DMA controller-based systems are expensive.
Cache coherence troubles can occur while using DMA for transferring data.
System price can be increased.
Motor
Control Application
Data Distribution System
Many industrial and factory lines require multiple programmable voltage sources, and this can be
generated by a bank of DACs that are multiplexed. The use of a DAC allows the dynamic change
of voltages during operation of a system.
Digital Potentiometer
Almost all digital potentiometers are based on the string DAC architecture. With some
reorganization of the resistor/switch array, and the addition of an I2C compatible interface, a
fully digital potentiometer can be implemented.
Software Radio
A DAC is used with a Digital Signal Processor (DSP) to convert a signal into analog for
transmission in the mixer circuit, and then to the radio’s power amplifier and transmitter.
b) Write a program to make the stepper motor to rotate both clockwise and counter
clock wise direction.
Assembly Code
7. a) Explain ADC 0809 with neat sketch and explain how can ADC 0809 interfaced with
8086?
• The ADC is an input device to microprocessor that sends an initializing signal to the
ADC to start the analog signal to digital conversion process. The start of conversion
signal is a pulse of a specific duration
• The process of analog to digital conversion is a slow process and the processor has to
wait for the digital data till the conversion is over.
• After the conversion, the ADC sends the End of Conversion (EoC) signal to inform the
processor about it and the result is ready at the output buffer of the ADC. The tasks of
issuing SOC pulse to ADC, reading EOC signal from the ADC and reading the digital
output of the ADC are carried out by the CPU using 8255 I/O ports
• The time taken by the ADC to calculate the equivalent digital data output from the
moment of the start of conversion is called conversion delay of the ADC
• It may range anywhere from a few microseconds, in case of fast ADCs, to even a few
hundred milliseconds in case of slow ADCs.
• The ADCs available in the market use different conversion techniques for the conversion.
• Successive approximation and dual slope integration techniques are the most popular
techniques used in the integrated ADC chips
• Irrespective of the techniques used for conversion, general algorithm for ADC
interfacing contains the following steps
3. Read End of Conversion (EOC) signal to mark the end of conversion process
The ADC chips 0808 and 0809 are 8-bit CMOS, successive approximation converters.
Successive approximation technique is of the fastest technique used for the process of
analog to digital conversion.
The conversion delay is 100μs at a clock frequency of 640 KHz, which is quite low as
compared to other converters.
These converters internally have a 3:8 analog multiplexer so that at a time eight different
analog inputs can be connected to the chips.
Out of these eight inputs only one can be selected for conversion by using address lines A,
B C..
Block Diagram of ADC 0808/0809
b) Bring out the differences between static and dynamic RAM. Describe the procedure of
interfacing static memories with a CPU.
Arrange the available memory chips so as to obtain 16-bit data bus width.
The upper 8-bit bank is called ‘odd address memory bank’ and the lower 8-bit bank is
called ‘even address memory bank’
Connect available memory address lines of memory chips with those of the
microprocessor and also connect the memory RD and WR inputs to the corresponding
processor control signals. Connect the 16-bit data bus of the memory bank with that of
the microprocessor 8086.
The remaining address lines of the microprocessor, BHE and A o are used for decoding
the required chip select signals for the odd and even memory banks.
The CS of memory is derived from the output of the decoding circuit.
As a good and efficient interfacing practice, the address map of the system should be
continuous as far as possible.
In this way, this unit selects one of the three registers- data buffer register, control register, status
register.
From the following table, we can see how to read or write data word, read the status word and
write control word.