CSC270 Lab 9
Contents
Designing a 1-bit input I/O controller
Again tonight you have a simple design to implement, but you should make sure you go through the steps carefully.
This lab assumes that you have assembled, designed and fully tested the 1-bit output controller of Lab #8.
Step 1
The basic design. Complete the address decoding part of the schematics below, adding the design we did in class this morning.
Connect the E and address bits to the decoder the exact same way you did in Lab 9, so that you will not have to change the wiring on your kit.
What hexadecimal address did you assign to your flipflop in lab 9?____________
What Yi output is activated by this address? _________
This is the same address we will use for your 1-bit input. We can use both
addresses because in the new design the output port (flipflop) is energized only when R/W is low
(the processor writes the bit to the flipflop), and the input port you are
building tonight will be energized only when R/W is high (the processor will read
the bit generated by the switch).
Draw the timing diagrams for a STAA XXXX and a LDAA XXXX instruction, where XXXX is the address you the I/O port. Make sure you show E, the Address bus, R/W, D0, the clock input of the flipflop, and the active-low enable of the tri-state driver.
Step 2
Write an endless loop that will constantly read a byte at the address corresponding to your 1-bit input device, and write it back at the same address, storing it in the 1-bit flipflop.
Assemble the program, and enter it in your kit.
Run the program.
Use the scope and verify that the Yi output of the decoder that you are currently using for your 1-bit flipflop is energized by your program. It should look something like this:
Monitor the R/W signal as well, and watch both the Yi output and R/W.
You should observe something similar (though not exactly equal) to the
following picture:
Report your observations on the grid below. Explain why you see a R/W pulse only every other Yi pulse. Make sure you record the scales, and indicate which signal is which!
<img width="50%" src="oscilloscopeGrid.gif"><img width="50%" src="oscilloscopeGrid.gif">
Step 3
You have several tri-state drivers available to you tonight:
All three are 20-pin devices, with Vcc on Pin 20, and GND on Pin 10.
For each one of them, generate the boolean expression that is a function of your Yi output and R/W that should should be applied to the gate(s) of your tristate driver so that the driver is turned ON only when R/W is high, and Yi is low. Note that the gate inputs for all three tristate drivers are active low.
Pick the driver that yields the simplest design for you.
- Remember that you may already have OR gates and inverter powered up on your breadboard!
Step 4
Wire up the boolean expression you found in Step 3.
Do not connect the output of the driver to D0 yet!
Connect the gate input(s) of your driver to the oscilloscope and observe it/them along with R/W and your Yi signal (you may have to borrow probes from your neighbors). Verify that your driver is turned ON only when R/W is high and Yi is low. You shouldn't connect the output of your driver to the data bus until you are sure that the gate is activated at the right time. Failure to do this will result in the destruction of some chips (either the ones on your breadboard, or the ones inside the kit).
So, please, be careful!
Step 5
Once you have observed and verified the correct timing of the signals, connect the output of the driver to D0, and its input to one of the switches.
Activate the switch (you might want to use a tiny screwdriver), and verify that the LED turns ON or OFF according to the position of the switch, as we should expect.
Step 6
A bit of programming: Modify your program so that the LED blinks (choose whatever blinking frequency you wish) when the switch is in one position, and the LED is OFF when the switch is in the opposite position.
Again, demonstrate the correct operation of your program, please!