Sie sind auf Seite 1von 13

Introduction/background

We have learned quite a bit about microprocessors this semester. A lab like this gives us a great

opportunity to test what we know conceptually as well as a decent amount of experience dealing with bit wire-wrapping circuitry and data sheet research which are very useful skills in testing and implementing circuits. Equipment List - 6802 Microcontroller - AT28C64 EEPROM - 74LS373 Latches - GAL16V8 (we substituted and used ATF16V8BQL) - 74LS244 Tri-state Buffers

connecting devices to microprocessors and writing code using a programmer device. We also did quite a

- 330 (to limit current), 1000 resistors (pull-up resistors) - Decoupling Capacitors - LEDs - Switches - Lots of wire - Wire-strippers and Wire-wrapper tools - WinCUPL - PLD/EEPROM programmer - DC power supply - Oscilloscope - Board with stand

Procedure 1) Set up the voltage regulator and non-bus pins for the 6802 - We wired up the regulator with 2 larger gauge wires connected to ground and Vout that were completely stripped. We organized the wires to run along opposite sides of the board with several pins soldered to them for wire-wrap connections. - Using the information provided in the data sheet for the 6802, we wired all the pins that would need to be permanently connected to +5V (VCC, RE, MR, NMI, IRQ) and to ground (VSS). - We wired our oscillator by connecting each end to EXTAL and XTAL and also through a capacitor to ground. - We placed decoupling capacitors from power to ground on both sides of the regulator and on the 6802. - We wired our reset switch with a pull-up resistor as follows:

- We tested our clock signal by measuring pin 37 (E) with an oscilloscope.

The oscilloscope measured an oscillation between 0 and +4.96V at 999.5 kHz which is what we were expecting.

Most of what the circuit looked like after step 1 (We did need to change a few things at this point)

2) Set up the LEDs - I wanted to wire the LEDs/6802 in a way that the 6802 would source the current, so I connected the cathode of each diode to ground and the anode to a currentlimiting resistor (330). Then, each resistor was connected to the output pins of the latch. I wired them in such a way to give the following LED setup:

7 8

5 6

3 4

1 2

- The latch was wired so that each output pin connected to the corresponding LED (resistor), and each data pin on the latch was connected to the corresponding data pin on the 6802. The OE pin was connected to ground, and C was left to be connected to our decoder later. Each LED circuit would look something like this:

After some of the wiring of the LEDs

3) Set up the Switches - I wired the switches in a way similar to the reset switch with pull-up resistors. The switches were connected to the tri-state buffers inputs (A pins) and the output pins (Y pins) of the buffers were connected to the data bus. The 1G and 2G pins were wired together to be wired to the decoder later. Each switch looked something like this:

After wiring the latches and buffers

4) Set up the decoder

- To program the decoder, I used a template for WinCupl and wrote the various logic circuits required for the chips that needed it. I included the code later in this report. I tested the decoder using a digital trainer, but was not successful until I replaced the pins from the decoder to the EEPROM, latches, and buffers.

chip. We wired the decoder by connecting the required inputs from the 6802, and output

The setup I used to test the decoder. (sorry that it is so blurry, I think that my camera had a weird setting on)

5) Setup of the EEPROM

- Most of the wiring of the EEPROM consisted of connecting the appropriate address and data pins to the bus. We also wired WE to +5V to disable it. - Sometime around this point we accomplished a few miscellaneous tasks. We wired decoupling capacitors for our EEPROM and decoder. Josh went back and soldered create the schematic seen later in this report. anything that still needed to be and he also went back through all of the data sheets to

The top and bottom of our board after we completed all of the wiring.

6) Writing the programs and testing them

- To create the programs I first wrote them in assembly language and then handtranslated them into machine code. Then, I entered the code into the buffer section of the lab programmer (after selecting the correct device). I then tested each of the programs on the board which all worked successful eventually.

- To test the first simple program, we measured the A0 pin on the 6802. The pin would be high on odd addresses and low on even ones which would mean for our program while command is executed) in a loop, we could expect to see something like this: which repeatedly went through the addresses $0000, $0001(stays here for 3 clock ticks

Program 1 before and after pushing the reset switch

Code Listing Program 1: //used to test the reset switch by making the reset vector (1FFE,F) point to the start of our ROM and then go into an infinite loop. Assembly Instruction BRA $FE Program 2: //used to blink lights 3 times at a moderate pace then go into an infinite loop Assembly Instruction LDAB #$03 LDAA #$FF STAA $4000 LDX #$8FFF DEX BNE LDAA #$00 STAA $4000 LDX #$8FFF DEX BNE DECB BNE BRA Program 3: //used to read input from switches and then display with LEDs Assembly Instruction LDAA $8000 STAA $4000 BRA Program 4: Translation (address, data) ($0000,B6)($0001,80)($0002,00) ($0003,B7)($0004,40)($0005,00) ($0006,20)($0007,FE) Comment Location of Switches LEDs output of switches Infinite Loop Translation (address, data) ($0000,C6)($0001,03) ($0002,86)($0003,FF) ($0004,B7)($0005,40)($0006,00) ($0007,CE)($0008,8F)($0009,FF) ($000A,09) ($000B,26)($000C,FD) ($000D,86)($000E,00) ($000F,B7)($0010,40)($0011,00) ($0012,CE)($0013,8F)($0014,FF) ($0015,09) ($0016,26)($0017,FD) ($0018,5A) ($0019,26)($001A,E7) ($001B,20)($001C,FE) 1B-2=19(2s comp=E7) Infinite Loop Branch to $0010 All LEDs off Comment 3 loops of blinking All 8 LEDs on Address of LEDs Delay variable Translation (address, data) ($0000,20)($0001,FE) Comment FE=-2 spaces back($0000)

//used to rotate lights at a speed that is dependent on the switches input

//bug: if input is all zeroes blinks really slow instead of really fast because the value is re-enter all of my code

decremented before it is checked. This could easily(but tediously) be fixed but I did not want to //also, I realize this is very redundant code but it seemed easier for me at the time to copy and paste eight times than to try to setup and translate a subroutine. In retrospect, a loop and shift instruction would have been a good idea Assembly Instruction LDAB $8000 LDAA #$FF STAA $4000 LDX #$01FF DEX BNE DECB BNE LDAB $8000 LDAA #$00 STAA $4000 LDX #$01FF DEX BNE DECB BNE LDAB $8000 LDAA #$FF STAA $4000 LDX #$01FF DEX BNE DECB BNE LDAB $8000 LDAA #$00 STAA $4000 LDX #$01FF DEX Translation (address, data) ($0000,F6)($0001,80)($0002,00) ($0003,86)($0004,01) ($0005,B7)($0006,40)($0007,00) ($0008,CE)($0009,01)($000A,FF) ($000B,09) ($000C,26)($000D,FD) ($000E,5A) ($000F,26)($0010,F7) ($0011,F6)($0012,80)($0013,00) ($0014,86)($0015,04) ($0016,B7)($0017,40)($0018,00) ($0019,CE)($001A,01)($001B,FF) ($001C,09) ($001D,26)($001E,FD) ($001F,5A) ($0020,26)($0021,F7) ($0022,F6)($0023,80)($0024,00) ($0025,86)($0026,10) ($0027,B7)($0028,40)($0029,00) ($002A,CE)($002B,01)($002C,FF) ($002D,09) ($002E,26)($002F,FD) ($0030,5A) ($0031,26)($0032,F7) ($0033,F6)($0034,80)($0035,00) ($0036,86)($0037,40) ($0038,B7)($0039,40)($003A,00) ($003B,CE)($003C,01)($003D,FF) ($003E,09) LED7 LED 5 Back to $0008 Get speed again LED 3 Branch to $0010 Comment Get speed variable (switches) LED 1 Address of LEDs Delay variable

BNE DECB BNE LDAB $8000 LDAA #$FF STAA $4000 LDX #$01FF DEX BNE DECB BNE LDAB $8000 LDAA #$00 STAA $4000 LDX #$01FF DEX BNE DECB BNE LDAB $8000 LDAA #$FF STAA $4000 LDX #$01FF DEX BNE DECB BNE LDAB $8000 LDAA #$00 STAA $4000 LDX #$01FF DEX BNE DECB BNE

($003F,26)($0040,FD) ($0041,5A) ($0042,26)($0043,F7) ($0044,F6)($0045,80)($0046,00) ($0047,86)($0048,80) ($0049,B7)($004A,40)($004B,00) ($004C,CE)($004D,01)($004E,FF) ($004F,09) ($0050,26)($0051,FD) ($0052,5A) ($0053,26)($0054,F7) ($0055,F6)($0056,80)($0057,00) ($0058,86)($0059,20) ($005A,B7)($005B,40)($005C,00) ($005D,CE)($005E,01)($005F,FF) ($0060,09) ($0061,26)($0062,FD) ($0063,5A) ($0064,26)($0065,F7) ($0066,F6)($0067,80)($0068,00) ($0069,86)($006A,04) ($006B,B7)($006C,40)($006D,00) ($006E,CE)($006F,01)($0070,FF) ($0071,09) ($0072,26)($0073,FD) ($0074,5A) ($0075,26)($0076,F7) ($0077,F6)($0078,80)($0079,00) ($007A,86)($007B,02) ($007C,B7)($007D,40)($007E,00) ($007F,CE)($0080,01)($0081,FF) ($0082,09) ($0083,26)($0084,FD) ($0085,5A) ($0086,26)($0087,F7) LED 2 LED 4 LED 6 LED8

JMP

($0088,7E)($0089,E0)($008A,00)

Jump back to start

Program for the decoder (WinCUPL): //note: when I programmed the Atmel chip, I deselected use device in file in the device options
/********************************/ /* */ /* This is a template CUPL file */ /* */ /********************************/ Name Partno Revision Date Designer Company Location Assembly Device Decoder.pld; 123456; 01; 4/23/2013; Alex Carnahan; BJU; None; None; G16V8; /* must match your file name */ /* Make up your own part number */ /* Set the date */ /* Set your name */

/* Generic GAL16V8 */

/*************************************/ /* Inputs: Give names to input pins */ /* Range: Pins 2-9 are inputs */ /* Example: Pin 2=A; */ /*************************************/ pin 2= A14; pin 3= A13; pin 4= VMA; pin 9= E; /***************************************/ /* Outputs: Give names to output pins */ /* Range: Pins 12-19 are outputs */ /* Example: Pin 12=X; */ /***************************************/ pin 12= Eprom; pin 13= LED; pin 14= Switch; pin 19= Enot; /**********************************************************/ /* Logic: Define the relationship of inputs to outputs */ /* */ /* Symbols: & = AND */ /* # = OR */ /* ! = NOT */ /* $ = XOR */ /* */ /* Example: X = (!A & B & !C) # !(A & !C); */ /**********************************************************/ Eprom = !(A14 & A13 & VMA); LED = (A14 & !A13 & VMA); Switch = !(!A14 & !A13 & VMA); Enot = !E;

Circuit Diagram

//We also sent a separate pdf file so the wires could be observed more thoroughly

Conclusion

The lab was very successful, and we were able to finish with a descent working program that

used the EEPROM, LEDs, and the switches. This lab really put a lot of the concepts we learned in

lecture and homework to practice. I considered this lab to be a good addition to this class. However, I lengthy because it probably took too much time accomplish in its entirety.

would suggest that if this project is attempted again in future years, that it be revised to be not quite so

Das könnte Ihnen auch gefallen