You Asked for It… Design Using the Z-World. Next Week In DIG II  Timers and counters  Watchdog timers  UART (Universal asynchronous receiver / transmitter)

Slides:



Advertisements
Similar presentations
Teaching with Immersive Gaming: CPD 2 Using the NEnet Twigging Slide.
Advertisements

1 ECE 372 – Microcontroller Design Parallel IO Ports - Outputs Parallel IO Ports E.g. Port T, Port AD Used to interface with many devices Switches LEDs.
The 8051 Microcontroller and Embedded Systems
Real-Time Library: RTX
4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
Chung-Ta King National Tsing Hua University
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Activity 1: Where am I? Play in pairs Each player has a number line or bead string and a pack of number cards Each player takes turns to turn over a number.
Helen Ruffin Reading Bowl The Rules of Engagement.
Counter Circuits and VHDL State Machines
Objective The object of the game is to convert as many hexadecimal numbers to binary coded decimal numbers correctly within thirty (30) seconds. How.
Coordinate Based Tracking System
Motor Control of an Oscillating Pendulum Nick Myers and Chirag Patel March 9, 2004 Advised by: Dr. James Irwin and Mr. Jose Sanchez Bradley University.
ASPPRATECH.
May not be used without permission from Responsive Learning Technologies  March 2010.
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
SAT ® Mathematics. Objective: Students will be able to follow the course schedule and will be exposed to the format and directions of the SAT. Handouts:
Programmable Logic Controllers
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
System Clocks.
January 18, 2014.
Input/Output Ports and Interfacing
A Few Words From Dilbert
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation.
11 Finding Winners Using Arrays Session 8.2. Session Overview  Find out how the C# language makes it easy to create an array that contains multiple values.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Dice Games for Math. Multiplication War Skill: Multiplication facts to 36 Players: 2 to 4 players Supplies: 2 dice and counters (such as M&Ms, Cheerios,
Last week’s project demos RC circuit with creative use of 7- segment display Demo in class tonight – don’t start on the next project until I’ve seen this.
©2009, Tom McKendree Biplanes ©2009, Tom McKendree.
2 Digit Divisors. 3,521 ÷ 26 = = 26 x = 26 x 3 Click the squirrel for a video on repeated multiplication.
GameBoy Advance Programming Timers. Common Practice Game timing is normally synchronized with the vertical blank. For certain applications such as precise.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
Blackfin Calculator Learning Game By Majed Al-Herbi Will Matthau Course: ECE3552 – Spring 2008 Instructor: Dr. Veton Kepuska.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 4 Standard Single Purpose Processors: Peripherals.
1 Interrupts, Resets Today: First Hour: Interrupts –Section 5.2 of Huang’s Textbook –In-class Activity #1 Second Hour: More Interrupts Section 5.2 of Huang’s.
SIMON Presented By: Amanda Buczkowski James Jenkins Fadi Hanna.
January 17, 2015.
Chapter 5 - Interrupts.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Lecture 3 CSE 341 – Microprocessors Lecture 3 Md. Omar Faruqe UB 1228
The Lovely Game of NIM. Version 1 - Classic NIM You will need seven objects, such as counters or blocks. It is a game for two players. Place the 7 counters.
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
CSCI1600: Embedded and Real Time Software Lecture 15: Advanced Programming Concepts Steven Reiss, Fall 2015.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Networked Embedded Systems Pengyu Zhang & Sachin Katti EE107 Spring 2016 Lecture 4 Timers and Interrupts.
PLC programming Part 3: Problems with solutions. Topics  Every problem is devided into three parts:  Technology description contains the general properties.
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
Decision Making: while loops and Boolean Logic. While Loops A while loop is a structure within ROBOTC which allows a section of code to be repeated as.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names.
68HC11 Interrupts & Resets.
Networked Embedded Systems Sachin Katti
Store Multiple Results?
4-Integrating Peripherals in Embedded Systems
4-Integrating Peripherals in Embedded Systems
AVR Addressing Modes Subject: Microcontoller & Interfacing
Let's Race! Typing on the Home Row
The winner is the first player to reach 20 points
Introduction to Microprocessors and Microcontrollers
A Vocabulary Review Activity
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Game Controller Lesson Two.
The winner is the first player to reach 20 points
1.) What does it mean to be living? 2.) When is something truly dead?
CSCI1600: Embedded and Real Time Software
It's time for The Feudal Game.
Wireless Embedded Systems
CSCI1600: Embedded and Real Time Software
Presentation transcript:

You Asked for It… Design Using the Z-World

Next Week In DIG II  Timers and counters  Watchdog timers  UART (Universal asynchronous receiver / transmitter)  Pulse width modulators  LCD controllers  Keypad controllers  Stepper motor controllers  Analog to digital converters  Real time clocks Chapter 4: Standard Single Purpose Processors: Peripherals

Dig-Off  This is a wacky – multiple choice – fill in the blanks – prove the following theorem – gimme the correct answer or else – type trivia game show, that is mostly on class material. You will be divided into groups, and each will have a buzzer. As soon as you think you know the answer, buzz in. Get it right, get base number of points for that question. Get it wrong, you lose that many points. The question, now twice the value, is up for grabs, until it is correctly answered or skipped. Note that some questions may have more than one correct answer, in which case, you need to identify ALL of them.  During each round, each group will have a screw. If you think the others do not know the answer to a question, buzz in first, and “screw” the group of your choice. If that group misses the question, they lose points. If they get it right, however, they get the points, and YOU lose the points, um…then you are screwed...  There are also special “impossible questions” worth 10 points. These are eligible for screw (except one), and hence make perfect opportunity to screw other groups.  After each round, the group with the lowest score, will ask for one team member from another group to be joined into their group. The other group then asks a member of the first group to join them. The team member lost to another group cannot be transferred back until the next round.  5% (or a suitable portion) of the final score of the winning group will be added to their final grade.

This Week in Dig II  Actual design example using Z-world  Buzzer design for Dr. Polikar’s semester-end Dig-Off! review Game Show  Specs:  There will be four buzzers  The system will continuously listen for any buzzer pressing activity  As soon as one of the buzzers is pressed, the actual buzzer on for 1 second when the button is pressed all other buzzers are disabled, an LED corresponding to that buzzer turns on the LCD displays group name / number The active LED and LCD retain current information for 10 s. then reset  When any of the buttons are pressed, reset entire system.

Buzz-In ! // BUZZ-IN.c // Application polls four switches to determine which one is pressed first. // When a "winner" is detected, a light corresponding to the successful switch // is activated; the other switches are disabled, and the buzzer is sounded for 1s. // SW2 controls led D2. // SW3 controls led D3. // SW4 controls led D4. // SW5 controls led D5. #use lcd2l.lib #use vdriver.lib main(){ int state,found,bcount,lcount; found=bcount=lcount=0; outport(CS1,0);// Clear LEDs (D2- D5) outport(CS1+1,0);// Note: CS1 is predefined to be address 0x4000 outport(CS1+2,0);// Each LED is then addressed at 0x4000, 4001, etc. outport(CS1+3,0); outport(CS1+4,0);// At 0x4004 is the buzzer. Turn off the buzzer. VdInit();// initialize the virtual driver lc_init();// initialize the LCD lc_pos(0,0);// Move LCD cursor to the 0,0 location (1st row, 1st column) lc_printf(" System Ready");// Display " System Ready" on the LCD display lc_pos(1,0);// Move LCD cursor to the 1,0 location (2nd row, 1st column) lc_printf("Polikar's Buzz-In 1.0");

for(;;){// endless loop hitwd(); runwatch();// This code uses the watchdog timer facility, resetting timer at each pass. costate{// Start costate: everything within the costate loop is executed "at the // same time" (sort of) waitfor(DelayMs(1L));// Wait for 1 milisecond. So, all of the following will be // repeated every 1ms. state = ~inport(CS2+1);// Get the pushbutton values SW2-SW5 by querying // address 0x4041 (i.e., CS2+1) // All switches are located at the address 0x4040. // One additional 8 bit address bit used as a mask, // controls individual switches. 0-3 actual switches, // 4-7 for external switches, controlled by the jumper. if ((!found)&&( state & 0x10 )){// External switch ESW2 pressed...we find this out by // masking all bits except bit b4, which corresponds to // ESW2 lc_init();// initialize the LCD lc_pos(0,0);// Move LCD cursor to the (0,0) (1st row, 1st column) lc_printf(" Player One"); outport( CS1, 1 );// Turn on D2 (first LED) found=1;// Set flag to 1. } if ((!found)&&( state & 0x20 )){// ESW3 pressed (second switch)... outport( CS1+1, 1 );// Turn on D3 (second LED) lc_init(); lc_pos(0,0); lc_printf(" Player Two"); found=1; } Buzz-In !

if ((!found)&&( state & 0x40 )){// ESW4 pressed... outport( CS1+2, 1 );// Turn on D4 lc_init();lc_pos(0,0); lc_printf(" Player Three"); found=1; } if ((!found)&&( state & 0x80 )){// ESW5 pressed... outport( CS1+3, 1 );// Turn on D5 lc_init(); lc_pos(0,0); lc_printf(" Player Four"); found=1; } // This is where we control the buzzer time out and round time out. If none of // the reset buttons (ESW2-5) are pressed (see below), the program runs the buzzer // for 1 second (10x100ms, obtained through the bcount counter). The round // times out after 10 seconds (100x100ms, obtained through the lcount counter) if (found==1){ bcount=bcount+1; lcount=lcount+1; // At each millisecond wait (see above), the counts are // incremented by one. if (bcount == 1) outport(CS1+4,1); // When the flag is up (found==1), turn on the buzzer waitfor(DelayMs(100L));// Wait for 100 ms. if (bcount == 10) outport (CS1+4, 0); // When bcount reaches 10 (which means, 1000 ms has // elapsed), turn off the buzzer if (lcount > 100) {// When lcount reaches 100, (which means ms = 10 seconds), found = 0;// remove the flag and... outport(CS1,0);//... turn off everything outport(CS1+1,0); outport(CS1+2,0); outport(CS1+3,0); outport(CS1+4,0); lc_init(); lc_pos(0,0);//Reinitialized the LCD lc_printf(" System Ready"); found=bcount=lcount=0; }

// Alternatively, keep checking the four pushbuttons on the board (actual // switches, SW2-5, not ESW2-5). If any one of them is pressed, then the entire // system is to be resetted for the next round of play. if ((state & 0x01)||(state & 0x02)||(state & 0x04)||(state & 0x08)) { found =bcount=lcount= 0; outport(CS1,0);//turn off everything outport(CS1+1,0); outport(CS1+2,0); outport(CS1+3,0); outport(CS1+4,0); lc_init(); lc_pos(0,0); lc_printf(" System Ready"); } // End if top button hit } // End if found == 1 lc_pos(3,0); // Move cursor offscreen } // End costate }