📝 Mode Set Register of 8257 (21 MCQs)
Eight-Bit Configuration Word for DMA Channel Control
The 8257 mode set register is an eight-bit, write-only register used to enable individual DMA channels and select additional operating options. It is cleared by RESET, leaving all channels disabled. Software normally programs it after loading the address and terminal count registers, ensuring that an enabled channel cannot begin a transfer with incomplete parameters.
Individual Channel Enable Bits and Their Bit Positions
The four least significant bits enable the channels individually: D0 enables channel 0, D1 channel 1, D2 channel 2 and D3 channel 3. A bit set to one enables its corresponding channel. The upper four bits select rotating priority, extended write, TC STOP and Auto Load, respectively.
Operating Options Selected by D4 Through D7
D4 enables rotating priority, D5 selects extended write timing, D6 enables automatic channel disabling at terminal count, and D7 selects Auto Load operation. Rotating priority changes channel ranking after each DMA cycle. Extended write alters write-signal timing, while Auto Load uses channel 3 parameters to reinitialize channel 2.
Example of Enabling Channel 0 with Fixed Priority
Writing 01H to the mode set register sets D0 and clears D1–D7. Channel 0 is enabled, while channels 1–3 and all optional modes remain disabled. If the channel's address and terminal count registers were initialized beforehand, a valid DRQ0 request can initiate its programmed DMA operation.
Using TC STOP and Auto Load for Repeated Transfers
TC STOP automatically clears a channel's enable bit after its terminal count, preventing further transfers until software enables it again. Auto Load supports repeated or chained blocks through channels 2 and 3: channel 3 holds the next parameters, which are transferred into channel 2 during an update cycle.
Correcting Errors in Mode Word Interpretation
'The mode set register stores the starting address' is incorrect because each channel has a separate address register. 'A zero channel-enable bit activates that channel' is incorrect because a one enables it. 'The mode set register is read to obtain channel completion' is incorrect because it is write-only; completion is checked through the status register.
Decoding Mode Set Values in Programming Questions
Memorize the bit order D7 to D0 as Auto Load, TC STOP, extended write, rotating priority and channel enables 3 through 0. Convert a required configuration into binary before hexadecimal. Check that the channel address and count were initialized first, and distinguish TC STOP from the peripheral's responsibility to stop requesting service.
Mode Register Bits and Operating Options
- D0–D3 - Enable channels 0–3 respectively.
- D4 - Enables rotating priority.
- D5 - Enables extended write timing.
- D6 - Enables TC STOP.
- D7 - Enables Auto Load.
- Auto Load - Reloads channel 2 from channel 3.
📝 All Mode Set Register of 8257 MCQs
Q1. Which of the following bits in the Mode Set Register selects the transfer mode for a channel?
📖 Explanation: The correct answer is B because bits 2‑3 of the Mode Set Register are defined by the 8257 specification to encode the transfer mode (single, block, demand, or cascade). Bits 0‑1, 4‑5, and 6‑7 control other functions such as address increment, auto‑initialize, and channel enable, so they do not select the mode. Understanding which bits select the mode helps designers program the DMA correctly, ensuring the right data‑transfer behavior in real hardware.
Q2. What effect does setting the Auto‑Initialize (AI) bit in the Mode Set Register have on subsequent DMA operations?
📖 Explanation: When the AI bit is set, the 8257 automatically reloads the count and address registers to their initial values after a transfer completes, allowing continuous operation without CPU intervention. The other options describe behaviors that are not linked to the AI bit: stopping the channel, freezing the address, or ignoring requests would prevent the intended repeated transfers. This auto‑reload capability is crucial for applications like continuous audio streaming where the same buffer is reused.
Q3. A system requires a DMA channel to transfer data in a descending address order. Which Mode Set Register setting must be programmed?
📖 Explanation: The Increment bit determines whether the address register increments (1) or decrements (0) after each byte transfer. To achieve descending addresses, the bit must be cleared to 0. Selecting block mode or enabling auto‑initialize does not affect the direction of address change, and setting the increment bit to 1 would cause ascending addresses, contrary to the requirement. Properly configuring the increment direction is essential for operations such as reading backward through a memory‑mapped file.
Q4. In a design where two peripheral devices share the same DMA channel, which Mode Set Register configuration prevents bus contention?
📖 Explanation: Cascade mode effectively disables the DMA channel, allowing the external device to take control of the bus without interference from the 8257. Enabling Auto‑Initialize or selecting Demand/Block modes does not address contention; they merely define transfer size or request handling. By programming the Mode Set Register to Cascade, the designer ensures that the shared channel does not generate competing requests, thereby avoiding bus conflicts in multi‑device environments.
Q5. Which of the following best describes the purpose of the Transfer‑Mode bits (bits 2‑3) in the Mode Set Register?
📖 Explanation: The Transfer‑Mode bits directly encode the four possible operation types of the 8257: single, block, demand, and cascade. These modes influence how the controller reacts to request signals and how many bytes are moved per request. The other options refer to unrelated aspects such as byte count, acknowledge timing, or channel priority, which are governed by different registers. Knowing the role of these bits lets engineers choose the appropriate DMA behavior for tasks like burst transfers or continuous streaming.
Q6. A microcontroller needs to perform a block transfer of 256 bytes using channel 2. Which Mode Set Register setting must be combined with the correct count register value?
📖 Explanation: Block mode tells the 8257 to move a predefined number of bytes automatically after a single request. For 256 bytes, the count register stores the value 255 because the count is zero‑based (actual transfers = count + 1). Single mode would require a request for each byte, making it inefficient, while Demand mode continuously transfers as long as the request line stays asserted, which is unnecessary here. Cascade disables the channel, so it cannot perform the transfer. Properly combining block mode with the correct count ensures the DMA moves the full 256‑byte block with minimal CPU involvement.
Q7. If a designer forgets to set the Auto‑Initialize bit for a repetitive audio playback loop, what is the most likely outcome after the first buffer transfer completes?
📖 Explanation: Without the Auto‑Initialize bit, the 8257 does not reload the address and count registers after the initial block completes, causing the channel to stop. The controller does not automatically generate an error interrupt nor does it continue transferring; it simply becomes idle until the CPU re‑programs the registers. Automatic address wrap‑around is not a built‑in feature of the 8257. This behavior emphasizes the need to enable auto‑initialize for continuous loops such as audio playback.
Q8. A system uses DMA channel 0 to read from a memory‑mapped sensor at a fixed rate. Which Mode Set Register configuration best matches this requirement?
📖 Explanation: Demand mode allows the DMA controller to transfer data as long as the peripheral holds the request line active, which suits a sensor that continuously signals readiness. Enabling Auto‑Initialize ensures the address and count are reloaded after each block, allowing the transfer to repeat without CPU intervention. Single mode would require a new request for each byte, making it inefficient, while Block mode without demand would wait for a single request only. Cascade disables the channel entirely, which is unsuitable.
Q9. When programming the Mode Set Register for a transfer that must increment the address after each byte, which bit must be set to 1?
📖 Explanation: The 8257 defines Bit 0 of the Mode Set Register as the address‑increment control; setting it to 1 makes the address register increase after each byte, enabling forward traversal through memory. Bit 1 actually controls the address‑decrement function (clearing Bit 0 and setting Bit 1 would cause descending addresses). Transfer‑Mode bits (2‑3) and the Auto‑Initialize bit are unrelated to address direction. Correctly setting the increment bit is essential for applications like sequential buffer filling.
Q10. A programmer wants to use channel 3 for a single‑byte transfer triggered by an external device. Which combination of Mode Set Register bits should be used?
📖 Explanation: Single mode (bits 2‑3 = 00) directs the 8257 to perform exactly one byte transfer per request. Auto‑Initialize should be cleared (0) because only one transfer is needed, and the Increment bit can be set to 1 for normal forward address progression. Block and Demand modes would cause multiple bytes to be moved, while Cascade disables the channel. This configuration matches the requirement of a single‑byte, request‑driven transfer.
Q11. Why is it important to clear the Auto‑Initialize bit when performing a one‑time DMA transfer?
📖 Explanation: Clearing the Auto‑Initialize bit tells the 8257 not to reload the count and address registers after the transfer finishes. This is crucial for a one‑time operation because reloading would cause the DMA to start another transfer unintentionally. The other options describe unrelated effects: address wrapping is not controlled by AI, disabling the channel is achieved by Cascade mode, and Demand mode selection is independent of the AI bit.
Q12. In a scenario where a DMA channel must transfer data in bursts of 4 bytes each, which Mode Set Register setting is most appropriate?
📖 Explanation: Block mode allows the controller to move a predefined number of bytes (count + 1) after a single request. Setting the count to 3 yields 4 bytes per burst. Enabling Auto‑Initialize (AI = 1) ensures the count and address reload for the next burst without CPU involvement. Single mode would require a request for each byte, making burst handling inefficient. Demand mode would keep transferring as long as the request line stays asserted, which may not produce the desired fixed‑size bursts.
Q13. A device connected to channel 1 asserts the request line continuously. Which Mode Set Register configuration will cause the DMA controller to transfer data only once and then wait for a new request?
📖 Explanation: Single mode makes the 8257 perform exactly one byte transfer per request, after which it stops waiting for the next request. Even if the request line stays asserted, the controller will not issue additional transfers until the CPU re‑programs the channel. Block mode would continue transferring the full count, and Demand mode would keep moving data as long as the request remains high. Cascade disables the channel entirely.
Q14. When configuring the Mode Set Register for a DMA channel that must wrap around a circular buffer of 1024 bytes, which bits must be set?
📖 Explanation: Block mode with Auto‑Initialize enables the controller to reload the address and count after each 1024‑byte transfer, effectively creating a circular buffer. Increment = 1 ensures the address moves forward through memory. Demand mode would not automatically restart after the buffer completes, and Single mode would be too slow for large buffers. Cascade disables the channel, making it unsuitable for continuous circular buffering.
Q15. Which of the following statements about the Auto‑Initialize (AI) bit is FALSE?
📖 Explanation: The false statement is D: clearing the AI bit does not force the channel to stop after the first byte; it merely prevents automatic reload of the registers. The channel may still continue transferring if the count permits. The other statements correctly describe AI behavior: setting AI = 1 enables automatic reload, and it works with any mode (single, block, demand). Understanding this helps avoid misconceptions when designing repetitive DMA operations.
Q16. A system designer needs to ensure that a DMA channel will not respond to spurious request signals during CPU idle periods. Which Mode Set Register bit should be cleared?
📖 Explanation: The Channel‑Enable (often part of the mode or a separate enable register) determines whether the DMA channel can respond to request lines. Clearing it disables the channel, preventing it from reacting to any spurious requests while the CPU is idle. Auto‑Initialize, Transfer‑Mode, and Increment bits affect transfer behavior after a request is accepted but do not stop the channel from being triggered in the first place.
Q17. During debugging, a technician observes that a DMA transfer stops after exactly 128 bytes, even though the program set the count to 255. Which Mode Set Register setting is most likely misconfigured?
📖 Explanation: If the Auto‑Initialize bit is cleared, the count register is not reloaded after the first block, causing the controller to stop after the initial 128‑byte count (since the count field holds only 14 bits, max = 16383, but the observed stop suggests the count was not reloaded). Single mode would require a request per byte, not cause a premature stop at 128 bytes. Clearing the Increment bit would affect address direction, not count size, and disabling the channel would prevent any transfer. Therefore, the missing AI setting explains the early termination.
Q18. A microprocessor uses DMA channel 2 to write a pattern to memory, then reads it back using the same channel. Which sequence of Mode Set Register configurations ensures correct operation?
📖 Explanation: Block mode with Auto‑Initialize set allows the controller to transfer a fixed number of bytes and then automatically reload the address and count for the subsequent read operation, enabling seamless back‑to‑back writes and reads. Single mode would be inefficient for large patterns, Demand mode would keep transferring as long as the request line is asserted (which may not be desired), and Cascade disables the channel, making any transfer impossible.
Q19. If the Increment bit is set to 0 and the Transfer‑Mode is Block, what will be the address behavior during the transfer?
📖 Explanation: Setting the Increment bit to 0 tells the 8257 to decrement the address after each byte transfer. In Block mode, the controller moves through the entire count without further CPU interaction, so the address will step downward for each byte. Increasing the address requires the Increment bit to be 1, while a constant address would need both Increment and Decrement bits cleared, which is not a defined mode. Wrapping to zero is not automatic; it requires explicit programming.
Q20. A designer accidentally programs the Transfer‑Mode bits to the Cascade setting while intending a Block transfer. What immediate effect will this have on the DMA channel?
📖 Explanation: Cascade mode disables the channel, causing it to ignore all DMA request signals until reprogrammed. It does not perform any transfers, single‑byte or continuous, and it does not affect address direction. Therefore, the channel will appear inert, which can be diagnosed by checking that no DMA activity occurs despite request signals. This highlights the importance of correctly setting the Transfer‑Mode bits.
Q21. When configuring a DMA channel for a high‑speed video stream, which Mode Set Register settings are most appropriate to minimize CPU overhead?
📖 Explanation: Block mode with Auto‑Initialize enabled allows the controller to move a large block of video data in one request and then automatically reload the address and count for the next block, drastically reducing CPU involvement. Increment set to 1 ensures forward memory traversal, which is typical for video buffers. Single mode would require a request per byte, creating excessive overhead, while Demand mode could cause uncontrolled continuous transfers and lacks the automatic reload benefit. Cascade disables the channel entirely.