ECE 371 Lab 8 -- 8237 DMA Controller Experiment

OBJECTIVE:  The purpose of this experiment is to familiarize the student with the initialization and use of the 8237 DMA controller chip.  PCs typically use this chip for DMA control.  The chip will be used to transfer 64Kb from a simple input port (an 8-bit DIP switch and buffered latch) wired on the lab breadboard.  You will write a C language program to verify that the transfer actually took place.

EQUIPMENT NECESSARY:
Breadboard
DIP switch
SPDT switch
74373 latch
Decoding logic

PRE-LAB:
The student will design a circuit that will allow an 8-bit binary value to be transferred from an input port to system RAM via DMA, using Channel 1 of one of the PCs two 8237 DMA controllers.  (The DMA chip you will need to use is assigned to port addresses 0000H to 000FH on the PC.)

The input port should consist of an 8 element DIP switch package which is connected to the data bus via an 8-bit buffer (74373 latch).  This buffer should be enabled only when the /DACK1 = 0 and /IORC = 0.  A DMA Block transfer should be initiated by a debounced SPDT switch that is implemented in the breadboard. (See Lab 7 for schematic of the debounced switch.)  The 8237 in the PC has been initialized to look for an active high DREQ1 signal.  After it has been initiated by your switch, the DMA controller should read the value of the DIP switches and write this value to the 64Kb of memory starting at location 80000H. Note:  since the 8237 can only put out a 16-bit address, the PC has a page register which supplies the upper 4 bits of the 20-bit physical memory address.  Therefore, before initiating the DMA transfer, it will be necessary for your software to write the "page number", a value of 8, into this register, which exists in the PC as Output Port 83H.  (See page I-26 in the course notes.)

1.  Based on the above specifications, draw a schematic for the circuit.
2.  Write a C language program to initialize the DMA chip.  You should start by clearing the byte pointer FF.  (Do NOT use the Master Clear option, since other channels of the 8237 are being used by the OS of the PC.)  For the same reason, do not disturb the Command Register of the 8237.  Your software should initialize the Address Register and Word Count Register for Counter 1, the Mode Register for channel 1, and unmask Channel 1, using the Write Single Mask Register Bit option.  In setting the mode, use the auto-initialize option; either the increment or decrement option can be chosen.  The program should continuously show the values in the first 8 locations of page 8 in the PCs memory (locations 80000H to 80008H).  This value should change when the SPDT switch is pressed, assuming that the DIP switch settings have been changed since the last time the SPDT switch was activated.
DURING LAB:
1.  Set up t he circuit on the breadboard.  Run the program to verify that the transfer occurs.  Make sure that you exit Turbo C before running your program, to avoid memory conflicts.  Demonstrate your program to the TA.

POST-LAB:
1.  Write a report which includes a program listing and schematic.  Discuss why a DMA transfer is more efficient than a CPU orchestrated transfer.

HINTS:
No hints are yet available.