introduction/background · - wincupl - pld/eeprom programmer ... programs on the board which all...

13

Upload: others

Post on 22-Oct-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

  • 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 connecting devices to microprocessors and writing code using a programmer device. We also did quite a bit wire-wrapping circuitry and data sheet research which are very useful skills in testing and implementing circuits.

    Equipment List – - 6802 Microcontroller - AT28C64 EEPROM - GAL16V8 (we substituted and used ATF16V8BQL) - 74LS373 Latches - 74LS244 Tri-state Buffers - 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 Most of what the circuit looked like after step 1 (We did

    999.5 kHz which is what we were expecting. 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 current- limiting 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 5 3 1

    8 6 4 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 chip. We wired the decoder by connecting the required inputs from the 6802, and output pins from the decoder to the EEPROM, latches, and buffers.

    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 anything that still needed to be and he also went back through all of the data sheets to create the schematic seen later in this report.

    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 hand- translated 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 which repeatedly went through the addresses $0000, $0001(stays here for 3 clock ticks while command is executed) in a loop, we could expect to see something like this:

    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 Translation (address, data) Comment BRA $FE ($0000,20)($0001,FE) FE=-2 spaces back($0000)

    Program 2: //used to blink lights 3 times at a moderate pace then go into an infinite loop

    Assembly Instruction Translation (address, data) Comment LDAB #$03 ($0000,C6)($0001,03) 3 loops of blinking LDAA #$FF ($0002,86)($0003,FF) All 8 LEDs on STAA $4000 ($0004,B7)($0005,40)($0006,00) Address of LEDs LDX #$8FFF ($0007,CE)($0008,8F)($0009,FF) Delay variable

    DEX ($000A,09) BNE ($000B,26)($000C,FD) Branch to $0010

    LDAA #$00 ($000D,86)($000E,00) All LEDs off STAA $4000 ($000F,B7)($0010,40)($0011,00) LDX #$8FFF ($0012,CE)($0013,8F)($0014,FF)

    DEX ($0015,09) BNE ($0016,26)($0017,FD)

    DECB ($0018,5A) BNE ($0019,26)($001A,E7) 1B-2=19(2’s comp=E7) BRA ($001B,20)($001C,FE) Infinite Loop

    Program 3: //used to read input from switches and then display with LEDs

    Assembly Instruction Translation (address, data) Comment LDAA $8000 ($0000,B6)($0001,80)($0002,00) Location of Switches STAA $4000 ($0003,B7)($0004,40)($0005,00) LEDs output of switches

    BRA ($0006,20)($0007,FE) Infinite Loop Program 4: //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 decremented before it is checked. This could easily(but tediously) be fixed but I did not want to re-enter all of my code //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 Translation (address, data) Comment LDAB $8000 ($0000,F6)($0001,80)($0002,00) Get speed variable (switches) LDAA #$FF ($0003,86)($0004,01) LED 1 STAA $4000 ($0005,B7)($0006,40)($0007,00) Address of LEDs LDX #$01FF ($0008,CE)($0009,01)($000A,FF) Delay variable

    DEX ($000B,09) BNE ($000C,26)($000D,FD) Branch to $0010

    DECB ($000E,5A) BNE ($000F,26)($0010,F7) Back to $0008

    LDAB $8000 ($0011,F6)($0012,80)($0013,00) Get speed again LDAA #$00 ($0014,86)($0015,04) LED 3 STAA $4000 ($0016,B7)($0017,40)($0018,00) LDX #$01FF ($0019,CE)($001A,01)($001B,FF)

    DEX ($001C,09) BNE ($001D,26)($001E,FD)

    DECB ($001F,5A) BNE ($0020,26)($0021,F7)

    LDAB $8000 ($0022,F6)($0023,80)($0024,00) LDAA #$FF ($0025,86)($0026,10) LED 5 STAA $4000 ($0027,B7)($0028,40)($0029,00) LDX #$01FF ($002A,CE)($002B,01)($002C,FF)

    DEX ($002D,09) BNE ($002E,26)($002F,FD)

    DECB ($0030,5A) BNE ($0031,26)($0032,F7)

    LDAB $8000 ($0033,F6)($0034,80)($0035,00) LDAA #$00 ($0036,86)($0037,40) LED7 STAA $4000 ($0038,B7)($0039,40)($003A,00) LDX #$01FF ($003B,CE)($003C,01)($003D,FF)

    DEX ($003E,09)

  • BNE ($003F,26)($0040,FD) DECB ($0041,5A) BNE ($0042,26)($0043,F7)

    LDAB $8000 ($0044,F6)($0045,80)($0046,00) LDAA #$FF ($0047,86)($0048,80) LED8 STAA $4000 ($0049,B7)($004A,40)($004B,00) LDX #$01FF ($004C,CE)($004D,01)($004E,FF)

    DEX ($004F,09) BNE ($0050,26)($0051,FD)

    DECB ($0052,5A) BNE ($0053,26)($0054,F7)

    LDAB $8000 ($0055,F6)($0056,80)($0057,00) LDAA #$00 ($0058,86)($0059,20) LED 6 STAA $4000 ($005A,B7)($005B,40)($005C,00) LDX #$01FF ($005D,CE)($005E,01)($005F,FF)

    DEX ($0060,09) BNE ($0061,26)($0062,FD)

    DECB ($0063,5A) BNE ($0064,26)($0065,F7)

    LDAB $8000 ($0066,F6)($0067,80)($0068,00) LDAA #$FF ($0069,86)($006A,04) LED 4 STAA $4000 ($006B,B7)($006C,40)($006D,00) LDX #$01FF ($006E,CE)($006F,01)($0070,FF)

    DEX ($0071,09) BNE ($0072,26)($0073,FD)

    DECB ($0074,5A) BNE ($0075,26)($0076,F7)

    LDAB $8000 ($0077,F6)($0078,80)($0079,00) LDAA #$00 ($007A,86)($007B,02) LED 2 STAA $4000 ($007C,B7)($007D,40)($007E,00) LDX #$01FF ($007F,CE)($0080,01)($0081,FF)

    DEX ($0082,09) BNE ($0083,26)($0084,FD)

    DECB ($0085,5A) BNE ($0086,26)($0087,F7)

  • 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 Decoder.pld; /* must match your file name */

    Partno 123456; /* Make up your own part number */

    Revision 01;

    Date 4/23/2013; /* Set the date */

    Designer Alex Carnahan; /* Set your name */

    Company BJU;

    Location None;

    Assembly None;

    Device G16V8; /* 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 would suggest that if this project is attempted again in future years, that it be revised to be not quite so lengthy because it probably took too much time accomplish in its entirety.