[Solved] ECE 362 Experiment 6 Rev 2/14 Bigger Bytes Lab Manual Experiment 6: Big > 10 Football Play Clock

$25

File Name: ECE_362__Experiment_6_Rev_2/14_Bigger_Bytes_Lab_Manual_Experiment_6:_Big_>_10_Football_Play_Clock.zip
File Size: 913.74 KB

SKU: [Solved] ECE 362 – Experiment 6 Rev 2/14 Bigger Bytes Lab Manual Experiment 6: “Big > 10” Football Play Clock Category: Tag:
5/5 - (1 vote)

ECE 362 Experiment 6 Rev 2/14 Bigger Bytes Lab ManualExperiment 6: Big > 10 Football Play ClockInstructional Objectives: To illustrate how an external interrupt device flag can be realized To illustrate use of port pins as both inputs and outputsParts Required: From DK-2 parts kit (used in ECE 270) breadboard and wire DIP switch and pull-up SIP LEDs ten 150 W resistors From DK-3 parts kit two common anode 7-segment displays (one is included in DK-2 parts kit) one 22V10 PLD (or equivalent) also included in DK-2 parts kitPreparation: Read this document in its entirety Complete the pre-lab steps and have them available for your instructor to checkIntroductionThe Big > Ten has a problem. Plagued by an ever-expanding roster of marginal football teams whose games seem to drag on forever (especially where one of the teams gets behind by, say, 42 points before the end of the first half), coach Boris Badenov of recently added Whatsamatta U has proposed a new rule that will help speed up these adventures in boredom:reduce the play clock time (i.e., the time allotted to line up and call the next play) to the number of teams that will be in the Big > Ten Conference effective 2014 (as of this writing, looks like 14). This change from the current 40/25 second rule has the potential to significantly reduce the boredom quotient (BQ) associated with the current football experience. Before Boris can get his billion-dollar bonus for coming up with such a brilliant idea, however, he needs to demonstrate a working prototype. Lucky for BB, there are a bevy of Boilermakers armed with 9S12C32microcontroller kits (along with a few surviving parts from their earlier digital life), betting their design will better the BQ of boisterous Boilermaker fans watching bloviating quarterbacks.Hardware OverviewYour job is to implement a 14-second play clock, i.e., a timer that when reset is loaded with thevalue 14 (displayed on two 7-segment LEDs) and count down in one second intervals until 1.0second remains, at which point it will count down in 0.1 second intervals from 1.0 to .0.The function of the play clock timer will be controlled by the two pushbuttons on the dockingmodule: the left pushbutton (PAD7) should reset the play clock to 14 seconds (at the end ofevery play), while the right pushbutton (PAD6) should start/stop the play clock (team calls atime out). The left LED on your docking board (connected to port pin PT1) should be onwhen the play clock is in the run state and off when it is in the stop state; the right LED(connected to port pin PT0) should be turned on when the count reaches .0. Note that theclock should stop counting down once it reaches .0, and that the right LED should remain onuntil the play clock is reset.ECE 362 Experiment 6 Rev 2/14Bigger Bytes Lab Manual -2- 2014 by D. G. MeyerA GAL22V10 PLD will be used to realize all the glue logic for this experiment. The functionof each Port T pin used in this design is listed in Table 1.Table 1. 9S12C32 Port T Connections to GAL22V109S12C32 Port T Function GAL22V10 PinPT2 tens (half) digit* 2 (input)PT3 middle decimal point 3 (input)PT4 BCD ones digit, least significant bit (D0) 4 (input)PT5 BCD ones digit (D1) 5 (input)PT6 BCD ones digit (D2) 6 (input)PT7 BCD ones digit, most significant bit (D3) 7 (input)* tens digit is either 1 (segments b and c of 7-segment display on) or blank, and therefore canbe controlled by a single bitOne of the functions the GAL22V10 will be programmed to perform is a BCD-to-display-codeconversion for the ones digit, as illustrated on page 19 of the ECE 270 Module 2 LectureSummary notes. It will also be used to buffer/drive the middle decimal point (on the two-digitdisplay) and the tens (half) digit. Since common-anode 7-segment displays will be used, thecorresponding output pins on the GAL22V10 will be programmed as active low. Note that a150W current limiting resistor should be used between each LED cathode and GAL22V10 outputpin (the LED anodes will all be connected to +5 V). Output pins of the GAL22V10 used to drivethe display are listed in Table 2.Table 2. GAL22V10 LED Display OutputsGAL22V10 Pin* Destination14 (com, output) segments b and c of tens digit15 (com, output) middle decimal point16 (com, output) segment a of ones digit17 (com, output) segment b of ones digit18 (com, output) segment c of ones digit19 (com, output) segment d of ones digit20 (com, output) segment e of ones digit21 (com, output) segment f of ones digit22 (com, output) segment g of ones digit* all active low a 150W current limiting resistor isrequired between each LED cathode and PLD pinECE 362 Experiment 6 Rev 2/14Bigger Bytes Lab Manual -3- 2014 by D. G. MeyerThe second function the GAL22V10 will be programmed to realize is an interrupt device flag forthe timing function. Here, a 10 Hz interrupt source will be provided by the function generator atyour lab station (use its SYNC output only, which provides a CMOS-compatible square wavesignal at the frequency of interest). This external clocking signal will be connected to the CLKinput of the GAL22V10 (pin 1), which will then cause a flip-flop within the PLD (device flag)to set on positive (low-to-high) clock edges. The active low device flag output (pin 23) will beconnected to the IRQ input of the 9S12C32 (port PE, pin 1). The device flag flip-flop will beasynchronously cleared (by the interrupt service routine) via port M, pin 3 (programmed as anoutput pin via the DDRM register). These connections are summarized in Table 3.Table 3. 9S12C32 Port E Connections to GAL22V10Source Function GAL22V10 Pin9S12C32 PM3 (output) asynchronous clear of device flag (active high) 8 (input)9S12C32 PE1 (input) CPU IRQ (active low) 23 (reg, output)Function GeneratorSYNC (output)10 Hz interrupt request (positive edge) 1 (input)Software OverviewOnce the boot-up and initialization sequence is completed, the main program should simplyloop looking at various flags (SRAM locations used as Boolean variables) to see if someaction should be taken (this is sometimes called state machine code organization). Four suchflags will be needed: (a) the tenth second flag, (b) the left pushbutton (reset shot clock) flag,(c) the right pushbutton (start/stop) flag, and (d) the run/stop flag. Note that the timer valueshould be stored as two packed BCD bytes, with an implied decimal point between theones and tenths digit. For example, the value of the timer when reset should be 014.0 (storedas $0140); after the first interrupt (while the run flag is set), this value should be decrementedto 013.9 (stored as $0139), i.e., the (4-digit) timer value should be decremented by one (in BCD)every time an IRQ interrupt occurs (while the run flag is set). Note that the 4-digit BCD valuecan be decremented by adding $99 to each packed byte (starting with the low order byte),followed by a DAA.The main program logic should be organized as follows:If the tenth second (IRQ interrupt) flag is set, the following actions should take place: clear the tenth second (IRQ interrupt) flag if the run/stop flag is set (i.e., play clock is running), then decrement the play clock by one tenth of a second update the seven-segment display if the time remaining is 10 seconds or more, display the tens and ones digits if the time remaining is less than 10 seconds but more than 1.0 second, blank thetens display digit and only display the ones digit if the time remaining is less than 1.0 second, turn on the middle decimal pointand display the tenths digit instead of the ones digitECE 362 Experiment 6 Rev 2/14Bigger Bytes Lab Manual -4- 2014 by D. G. MeyerIf the left pushbutton (reset play clock) flag is set, the following actions should take place: clear the left pushbutton flag clear the run/stop flag turn off both the run/stop and time expired LEDs (on the docking module) reset the display to 14If the right pushbutton (start/stop) flag is set, the following actions should take place: clear the right pushbutton flag toggle the run/stop flag toggle the run/stop LED (on the docking module)The main program should also, in its polling loop, check to see if the play clock has reached .0;if it has, the following actions should take place: clear the run/stop flag turn on the time expired LED (on the docking module) turn off the run/stop LED (on the docking module)In addition to decrementing the timer value stored in memory (while the run flag is set), theIRQ interrupt service routine is also used to sample the pushbuttons and set the correspondingpushbutton flags accordingly (note that this will require an additional variable in memory totrack the pushbuttons previous state). if the previous state of the left pushbutton was high and its current state is low (note thatthe pushbuttons are momentary contact closures to ground, and that their default state ishigh), set the reset play clock flag if the previous state of the right pushbutton was high and its current state is low, set therun/stop flagPre-Lab Step 1. Interface Glue LogicWrite an ABEL or Verilog program for a GAL22V10 that realizes the interface glue logicdescribed in the Hardware Overview. Compile your program using ispLever and program yourdevice using the universal programmer at your lab station (review your ECE 270 Lab Manual ifyou have forgotten how to do this).To test your glue logic design, connect the two 7-segment displays to your GAL22V10 asdescribed in Table 2. Use a DIP switch (recalling the need for a pull-up SIP) to provide testinputs to pins 1-8 of the GAL22V10. Finally, connect a loose (spare) LED to pin 23 of theGAL22V10 (the active low IRQ signal), which you may want to leave in place for debuggingpurposes). Now you should be able to test the combinational BCD-to-display-code decodingfunctionality, the tens (half-digit) display, the middle decimal point, and the operation of thedevice flag (set by a low-to-high transition of CLK, cleared by an asynchronous reset).Once you have verified the operation of your interface logic and display circuitry, remove theDIP switch (and its associated pull-up SIP) from your breadboard and install yourmicrocontroller board. Note that you should only proceed if your glue logic circuitry isfunctioning correctly attempting to write code at this point will prove to be otherwise futile!ECE 362 Experiment 6 Rev 2/14Bigger Bytes Lab Manual -5- 2014 by D. G. MeyerPre-Lab Step 2. Schematic/WiringComplete the wiring diagram below, based on information provided in Tables 1-3. Be sure toinclude the requisite LED current limiting resistors (total of ten 150W resistors required). Afteryour TA has checked your schematic, connect your microcontroller module to the GAL22V10 asdescribed in Tables 1 and 3.ECE 362 Experiment 6 Rev 2/14Bigger Bytes Lab Manual -6- 2014 by D. G. MeyerStep 1. CodingComplete the ASM skeleton file provided on the course website. Note that the finished productshould work in a turn key fashion, i.e., your application code should be stored in flash memoryand begin running upon power-on or reset.Step 2. DemonstrationDemonstrate your working hardware and software to your lab TA, and be prepared to explainyour answers to the Thought Questions (below).Step 3. Thought QuestionsAnswer the following thought questions in the space provided below:(a) Why do we need to know the previous state of the pushbuttons, and set flags based ontheir transition from high to low?(b) Did you notice any anomalous behavior as a result of the relatively low (10 Hz) rate atwhich the pushbuttons are sampled? If so, what do you think might be a more appropriatesampling rate?

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] ECE 362 Experiment 6 Rev 2/14 Bigger Bytes Lab Manual Experiment 6: Big > 10 Football Play Clock
$25