Presentation is loading. Please wait.

Presentation is loading. Please wait.

Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 1Winter Quarter Software Design Project Lecture 29.

Similar presentations


Presentation on theme: "Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 1Winter Quarter Software Design Project Lecture 29."— Presentation transcript:

1

2 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 1Winter Quarter Software Design Project Lecture 29

3 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 2Winter Quarter ENG H192 Software Design Project Problem: Detect frequency of IR transmitter Two-person teams will -- –Design –Code –Test –Document Teams will be provided -- –Handy Board –Sharp GP1U5 IR receiver –Access to IR transmitter beacon

4 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 3Winter Quarter The Handy Board

5 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 4Winter Quarter The Sharp GP1U5 IR Receiver

6 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 5Winter Quarter General Description Your software must detect each of five (5) possible frequencies of transmitted IR light Frequency detected must be displayed on Handy Board LCD screen Frequencies will in the range of 20 to 150 Hz No frequency will be closer than 20 Hz to any other possible frequency Transmitted frequency will change automatically and randomly to one of the other possible frequencies

7 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 6Winter Quarter IR Transmission and Reception Program should continuously detect frequency of the transmitting beacon Handy Board screen should display received frequency in Hertz as an "integer" value Only one of the specified frequencies (or 0) should be displayed IR Receiver IR Transmitter 6 to 12 inches

8 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 7Winter Quarter The IR Beacon Signal IR Beacon Signal "Digitized" copy of signal X X 0 1 Time

9 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 8Winter Quarter A Possible Approach Take a number of measurements of the received signal at regular intervals Determine how long it took to take those measurements Analyze set of measurements Display appropriate frequency Repeat

10 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 9Winter Quarter Useful Handy Board Functions digital (p) -- Returns the value of the sensor connected to digital port "p" as a true/false value. –The parameter "p" should be in the range of 7 through 15, matching port to which receiver is connected –Note that "true" = zero volts, which is sometimes called "active low" start_button ( ) -- Returns the value of the start button. "True" when button is pressed.

11 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 10Winter Quarter Useful Handy Board Functions stop_button ( ) -- Returns the value of the stop button. "True" when button is pressed. mseconds ( ) -- Returns a long integer value representing the system time in milliseconds. –Like the seconds ( ) function, but data type of returned value is long & units are milliseconds reset_system_time ( ) -- Resets the count of system time to zero milliseconds.

12 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 11Winter Quarter Interactive C Remember, there are things that are different in IC (compared to ANSI C): –No function prototypes –Limited formats possible in printf –Array bounds checked at run time –No #include statements –Smaller set of allowable data types -- only int, long, float, char, and struct (v3.2 only) –Character strings are supported, but simple char variables are not

13 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 12Winter Quarter Interactive C More things that are different in IC (compared to ANSI C): –No switch/case construct –Can only do +, -, and * on long int –All source files must be compiled together –#define has global scope –User functions come first in source file –No do/while construct –No mixed mode arithmetic

14 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 13Winter Quarter Design Project "Deliverables" List of brainstorming ideas Neatly written algorithm and/or flow chart of user- written functions Documentation package which includes: –A description of the program for use by developers, complete with a list of variable names and uses –A description of the program for use by a general user with an abstracted discussion of the program.

15 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 14Winter Quarter Receiving in a "Noisy" World Real world communications are affected or "degraded" by noise, for example: –Normal conversations in a busy public place –Cell phones in fringe reception areas ("Can you hear me now?"™) –AM radio stations during thunderstorms Often measured as a "signal-to-noise" ratio which is usually called SNR Almost all forms of communication are range dependent -- longer range => lower SNR

16 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 15Winter Quarter Receiving in a "Noisy" World The IR transmitter and receiver system we are using is "range dependent" –How does light intensity vary as a function of distance? IR receiver "drops out" if transmitted signal is too weak –What does "drops out" mean? Can we improve our ability to "see"?

17 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 16Winter Quarter The "Noisy" IR Beacon Signal IR Beacon Signal "Digitized" copy of signal X X X X X 0 1 Time X X X X X X X X

18 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 17Winter Quarter A Possible "Noisy" Approach Take a number of measurements of the received signal at regular intervals Determine how long it took to take those measurements Analyze set of measurements and ignore periods that are shorter than average Compare results of several sets (Steps 1 - 3) Display appropriate frequency Repeat from beginning

19 Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 18Winter Quarter Possible Programming Pitfalls Failing to use global variables, particularly for medium or large arrays Scarcity of comments in code (comments don’t take any memory space) Improper use of Handy Board functions Not using modular approach to designing code Too much floating point arithmetic Too much code – exceed memory of Handy Board


Download ppt "Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 1Winter Quarter Software Design Project Lecture 29."

Similar presentations


Ads by Google