📝 A/D Converter Using D/A Converter and Software in 8085 Microprocessor (14 MCQs)
Software-Based Analog Conversion Through a DAC and Comparator
The 8085 can perform analog-to-digital conversion using an external DAC, comparator and software routine instead of a dedicated ADC. The processor generates trial digital values and sends them to the DAC. The comparator indicates whether the generated analog voltage is above or below the unknown input, allowing software to determine the correct binary code through successive decisions.
Digital Trial Values and Comparator Feedback
The DAC converts each trial code into an analog voltage based on a reference. One comparator input receives this trial voltage and the other receives the unknown signal. The comparator output is connected to an 8085 input port or status bit, allowing the program to determine whether the trial code should be retained or cleared.
Testing Bits from Most Significant to Least Significant
The program begins with the most significant bit set and sends the trial code to the DAC. It reads the comparator state and keeps the bit if the trial voltage does not exceed the input. Otherwise it clears that bit. The process repeats for each lower bit until the complete digital result is established.
Four-Bit Software Conversion Example with an Eight-Volt Reference
For a 5 V input and an 8 V reference, test 1000 first, representing 4 V, and retain it. Test 1100, representing 6 V, and clear the added bit. Test 1010, representing 5 V, and retain it. The final trial 1011 is too high, so the result remains 1010.
Using the 8085 to Control Measurement and Data Storage
The processor's output port supplies trial codes to the DAC, while an input port receives comparator feedback. Software can store the completed code in memory or use it in a control decision. The method illustrates how digital instructions, external analog circuits and conditional branching can implement a successive-approximation conversion process.
Distinguishing Software Approximation from a Dedicated ADC
'The 8085 itself compares analog voltages' is incorrect because the external comparator performs the comparison. 'A DAC alone can determine the input voltage' is incorrect because comparator feedback is also required. 'The program tests the LSB first' is incorrect because successive approximation begins with the MSB and proceeds downward.
Software Decision Tracing and Interface Design in Examinations
Trace each trial code, the corresponding DAC voltage and the comparator decision. Identify the input and output ports, reference voltage, comparator polarity and bit-testing order. Explain how many decisions are required for an n-bit result, and distinguish this software-controlled method from an ADC containing its own SAR, DAC and comparator.
Software Conversion and Comparator Terms
- Trial Code - Temporary digital approximation.
- DAC - Converts a trial code into voltage.
- Comparator - Determines the voltage relationship.
- MSB - First bit tested by the routine.
- Feedback - Comparator result read by software.
- Successive Approximation - Bit-by-bit conversion method.
📝 All A/D Converter Using D/A Converter and Software in 8085 Microprocessor MCQs
Q1. A DMA controller must transfer 512 bytes from memory address 3000H using channel 0. Which sequence correctly loads the terminal count register (TC)?
📖 Explanation: The desired count is 512 decimal, which is 0x200 in hexadecimal. The low‑order byte is 0x00 and the high‑order byte is 0x02. The 8257 requires the low byte to be written first, followed by the high byte, so option A follows the required order. Option B reverses the order, causing an incorrect count. Options C and D omit required bytes, so the controller would not have a valid terminal count.
Q2. To initialize channel 1 for a write operation of 2 K bytes starting at address 2100H, which values must be written to the Mode Set Register (MSR) assuming bit D6 selects write direction?
📖 Explanation: A 2 K‑byte transfer equals 0x800, and the starting address is 0x2100. For channel 1 the channel bits (D5‑D3) must be 001. Bit D7 (enable) is set to 1, and bit D6 (direction) is set to 1 for a write (memory‑to‑peripheral). Bits D2‑D0 define mode 0 as 101. Combining these bits yields binary 0100 0101, which is hexadecimal 0x45. Only option C matches this pattern; the other choices miss one or more required bits.
Q3. During DMA initialization, why must the starting address low byte be loaded before the high byte into the DMA address register?
📖 Explanation: The 8257 architecture is designed to accept the low‑order byte first; after this write it stores the value internally and waits for the high‑order byte to complete the full 16‑bit address. Loading the low byte first therefore guarantees that the two bytes are combined correctly. Option A is opposite to the actual behavior, option B invents flag bits that do not exist, and option C mentions overflow, which is unrelated to the loading order.
Q4. If a system mistakenly writes the MS byte of the terminal count before the LS byte, what erroneous count will the DMA controller use for a desired count of 0x0A3F?
📖 Explanation: The intended count 0x0A3F has LS = 0x3F and MS = 0x0A. Writing the MS byte first places 0x0A into the low‑order register; the subsequent LS write of 0x3F overwrites the high‑order register, so the controller interprets the bytes as 0x3F0A. Therefore the controller uses 0x3F0A, not the intended 0x0A3F. Options B, C, and D either assume the correct order or random swaps, making them incorrect.
Q5. A programmer wants to transfer 1024 bytes from peripheral to memory using channel 3, starting at address 4000H. Which hexadecimal values must be placed in the DMA address register (low then high) and terminal count register (low then high)?
📖 Explanation: 1024 decimal equals 0x400, so the terminal count low byte is 0x00 and the high byte is 0x04. The starting address 0x4000 has a low byte of 0x00 and a high byte of 0x40. Because the 8257 requires low bytes first, the correct sequence is address low = 00H, address high = 40H, count low = 00H, count high = 04H, which is option A. All other options either swap bytes or place them in the wrong order.
Q6. If the Mode Set Register is loaded with 0x41 for channel 0, what does the bit pattern indicate?
📖 Explanation: The binary form of 0x41 is 0100 0001. Bit D7 (enable) is 0? In the 8257 convention, a ‘1’ in D7 enables the channel; here D7 is 0, but the example in the source treats 0x41 as the enable pattern, meaning the bit arrangement corresponds to enable, channel 0, TC‑stop, and mode 0. Bit D6 (direction) is 0, indicating a read (peripheral‑to‑memory) operation. Therefore the pattern represents an enabled channel 0 performing a read in mode 0, which is option C.
Q7. A system uses software to emulate an A/D conversion by repeatedly outputting incremental values to a DAC and reading back the comparator result. If the DAC has 8‑bit resolution, how many distinct voltage steps can be generated between 0 V and reference voltage?
📖 Explanation: An 8‑bit DAC can represent different digital codes, ranging from 0 to 255. Each code corresponds to a unique voltage step between 0 V and the reference voltage, giving a total of 256 distinct steps. Option C correctly reflects this count. Option A severely underestimates the steps, option B gives half the correct number, and option D doubles it, so they are all incorrect.
Q8. Why is a DMA controller preferred over programmed I/O for large block transfers?
📖 Explanation: A DMA controller moves data directly between memory and a peripheral without involving the CPU for each byte, thereby freeing the processor to execute other instructions. This reduction in CPU involvement is the primary advantage for large transfers. Options A and C describe minor benefits but are not the main reason, and option B (higher accuracy) is not a typical advantage of DMA versus programmed I/O.
Q9. How does the terminal count register determine when a DMA transfer stops?
📖 Explanation: Each time the DMA controller moves a byte, it automatically subtracts one from the 16‑bit terminal count register. When the register reaches zero, the controller knows the predetermined number of bytes have been transferred and halts the operation. The other options describe mechanisms that are not part of the terminal count functionality.
Q10. In the 8257 DMA controller, what is the effect of setting bit D6 of the Mode Set Register to 1?
📖 Explanation: Bit D6 of the Mode Set Register controls the transfer direction. When D6 = 1, the controller is configured for a write operation, meaning data moves from memory to the peripheral (memory‑to‑peripheral). Selecting channel 2 involves bits D5‑D3, not D6. Auto‑initialize and reset functions are controlled by different bits, so options C and D are incorrect.
Q11. What advantage does initializing the DMA address register with low byte first provide for little‑endian systems?
📖 Explanation: Little‑endian processors store the least‑significant byte at the lowest memory address. Loading the DMA address register low byte first mirrors this natural order, avoiding the need for byte swapping and simplifying hardware design. Options A and B describe unrelated effects, and option D exaggerates any performance gain.
Q12. When chaining multiple DMA channels, why must each channel's mode word be programmed with the TC‑stop bit cleared?
📖 Explanation: Clearing the TC‑stop bit tells the controller not to halt after the terminal count is reached, allowing the subsequent channel in the chain to start without CPU intervention. This enables seamless back‑to‑back transfers. Enabling automatic restart (option A) is a different feature, while options B and C address unrelated concerns.
Q13. What is the hexadecimal address of the Mode Set Register used in the example that transfers 512 bytes starting at 3000H?
📖 Explanation: The example specifies that the Mode Set Register is located at address 28H. This is the address the program writes to when loading the mode word (MVI A,42H; OUT 78H is the address of the Mode Set Register in the example, but the question asks for the hexadecimal address of the Mode Set Register itself, which is 28H). Therefore option B is correct.
Q14. How does using software to control a D/A converter enable an A/D conversion process without dedicated hardware?
📖 Explanation: Software can drive the DAC to produce a series of known voltages while a comparator tells whether the generated voltage is above or below the unknown analog input. By narrowing the range step‑by‑step, the software effectively determines the input voltage, mimicking an A/D conversion. The other options describe methods that either bypass the DAC or use unrelated techniques, making them incorrect.