1 / 9

Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu

Lecture #4 EGR 262 – Fundamental Circuits Lab. EGR 262 Fundamental Circuits Lab Presentation for Lab #4 Lights and Switches – Real Time. Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu. Lecture #4 EGR 262 – Fundamental Circuits Lab.

janine
Download Presentation

Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture #4 EGR 262 – Fundamental Circuits Lab EGR 262 Fundamental Circuits Lab Presentation for Lab #4 Lights and Switches – Real Time Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu

  2. Lecture #4 EGR 262 – Fundamental Circuits Lab • Comments on Lab Notebooks • After grading Lab #1, a few comments about lab reports may be useful: • No loose printed sheets are allowed. Any printed sheets must be cut and taped onto lab notebook sheets. They must fit within the working area on the sheet so that they do not cover the sheet number, name, etc. • Label each section (PreLab, In-Lab, PostLab) • Add labels/instructions to each item– Tell the user what you are showing them. • Include all items listed on the checkoff sheet in each section. I will go through the list as I grade the labs looking for each item. • The In-Lab section should be mainly written by hand. Take notes and record data in the notebook as you work in lab. Remember that the notebook is somewhat like a diary, so record every problem that you encounter. For example, in Lab #2 did you have trouble getting PuTTY to connect? Did you record this problem and your solution to it?

  3. Lecture #4 EGR 262 – Fundamental Circuits Lab Lab #4: Lights and Switches – real time Lab #4 involves a modification of Lab #3 where the new program will count the number of times a button is pushed in a 10-second interval and then display that number on a 7-segment display. This lab particularly shows how a micro-controller can be used to build systems that control program execution in real-time. The program in Lab #3 counted the number of times that a button was pushed after the MicroStamp11 was reset, but the number of button pushes was not related to time (i.e., any amount of time could occur between button pushes). The program in Lab #4 should count the number of button pushes over a 10-second interval and then stop counting button pushes. So the program must keep track of the time deadline as well as count button pushes. Computer systems whose program executions satisfy a timed deadline are called real-time systems. In order to keep track of time with the MicroStamp11, new kernel functions are introduced. Switches must also be de-bounced to keep an accurate count of the button pushes.

  4. Lecture #4 EGR 262 – Fundamental Circuits Lab Non-real-time systems Programs execute without any consideration to how long it takes that program to run. Real-time systems Program execution is time sensitive. Some aspect of the computer program satisfies a time deadline. • Examples: • Performing mathematical calculations (analyzing a circuit, finding moments of inertia, etc.) • Measuring a voltage and displaying the result (i.e., a multimeter circuit). • Monitoring inputs and responding when certain sensors detect inputs (alarm systems, fire protection systems, etc). • Advancing a count on a display every time a button is pressed (Lab #3). • Examples: • Traffic light control system that synchronizes traffic lights along some main thoroughfare. • Car airbag system that must deploy an airbag within a critical amount of time. • Automotive feedback control system (measure engine performance and adjust engine operation). • Display the number of button presses that occur in a 10-second interval (Lab #4).

  5. Note: pause(1000) results in a pause of 1000ms or 1 s in standard mode, but is considerably off when using a MicroStamp11 in turbo mode (as we do). Multiply by a scale factor of 3.25 for turbo mode. Example: pause(3250) results in a pause of 1 second in turbo mode. Lecture #4 EGR 262 – Fundamental Circuits Lab More functions from kernel.c Lab #4 introduces three important new kernel functions that control the timing of events.

  6. Note: Use count (3, 3250) in turbo mode. Lecture #4 EGR 262 – Fundamental Circuits Lab

  7. Lecture #4 EGR 262 – Fundamental Circuits Lab • 4.1. Pre-lab Tasks: • (1) Write a C-language program (Program 4A - One Second Timer) to increment and display a count (mod-10) in one-second increments on a 7-segment display after a button is pressed. Display the count on the terminal program (PuTTY) as well. Include the program listing (with many comments). • (2) Write a description of how Program 4A works. • (3) Write another C-language program (Program 4B - Ten Second Button Counter) that counts the number of times a button is pushed over a 10-second interval. Your program should do the following: • The timed interval starts with a button push. • The system will count the number of times the button is pushed over a 10 second interval. • The system should stop the count when the 10 second time interval has expired. • The program should display all digits of the count on the 7-segment LED display. • The most significant digit of the count should be displayed first and the next significant digit should be displayed after a button push (prompt the user). • After all digits have been displayed, the program should return to the start and wait for a button push to start the next timed interval. • The count should be displayed on PuTTY as well. • Give the user clear prompts for all inputs. • Include the program listing in your notebook (with many comments).

  8. Lecture #4 EGR 262 – Fundamental Circuits Lab 4.1. Pre-lab Tasks (continued): (4) Write a description of how Program 4B works. (5) Include a schematic diagram breadboard layout. The following code segment is a ”partial” listing for program 4B that you can use as a starting point. void main(void){init();while(1){ pause(1000); // 1 s pause for standard mode – use 3250 for Turbo mode button(6);icount=count(6,10000); // replace 10000 with 32500 for Turbo modedisplay_digit(icount);}}

  9. Lecture #4 EGR 262 – Fundamental Circuits Lab 4.2. In-lab Tasks: (1) Compile and download Program 4A and demonstrate it to the instructor. Record any changes made to the program. Include a printout from the terminal program. (2) Use an online stopwatch program to determine the amount of time required for your program/circuit to display 60 counts. Record this time. If the time is not within 1 second of being correct (60 seconds), adjust the length of pause used in your program. Make a table showing the values used with the pause statement and the corresponding times. (3) Compile and download Program 4B and demonstrate it to the instructor. Record any changes made to the program. (4) Experimentally verify that Program 4B works correctly. Record (in a table) the number of button presses versus the displayed value for several cases, including the following number of button presses: 0, 1, 2, 5, 10, 15, 20, 25, and the highest number that you can press. Include a printout from the terminal program. (5) Include detailed handwritten comments (like a diary) of all activities during lab. 4.3. Post-Lab Tasks: (1) Include a final program listing for each program. Highlight any changes made to the original program listing and discuss the changes. (2) Discuss how well each program performed.

More Related