MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 What’s On for this week ? 1) 1st lab period • L1 - Intro to Stack (last thing, take circuit apart) • Work on draft report for L1 • L2 - PBASIC exercises (VISIO for flowcharts) • Work on draft report for L2 (or submit) 2) Tutorial • Rewire circuit, note errors, submit L1 report • Complete L2, submit L2 report 3) 2nd lab period • L3 – Light Sensing with the Stack 1 Notes on the Stamp Stack (prelab for L1) Press the white button, LED’s flash sequentially 1 MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 Report WORD template on lab website http://me.queensu.ca/courses/ MECH452/samples/ 1 or 2 sentence answers (but full sentences) Don’t forget the details. 4 2 MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 Measured resistance will be close, but how close ? Protoboard Tutorial (see Useful Links on course website) http://www.kpsec.freeuk.com/breadb.htm 3 MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 Notes on PBASIC Programming (prelab for L2) Lab objective is to introduce the student to the PBASIC language, editor, compiler and help menu. Some good habits (for writing software): • lots of comments • indented structure • lots of subroutines • variable names with context • flow charts (that follow drawing rules) • partner can look at code and understand it Header, program description comments 4 MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 indent to clarify loop structure DEBUG statements for troubleshooting subroutines for repetitive tasks Use PBASIC help on toolbar 5 MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 Things to learn about: variable types & names Four different variable types Reserved variable names Things to learn about: memory management Lab #4 ROM for lines of code RAM for variables 6 MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 Things to learn about: flow charts for design Only 5 symbols (subroutine not shown) Flow charts must have correct symbols, but also just enough detail to impart to the reader the logic (it’s an art). More than 15 ? You need a subroutine. Copy drawing Drag and drop Use pointer or line connector Double left click to add text Free 60 day trial at http://visiotoolbox.com/2010/trial-downloads.aspx 7 MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 Flow chart supplement on lecture website http://me.queensu.ca/courses/ MECH452/lectures/ Coffee maker example Start Decision (loop) mistake #1 Node Process mistake #2 mistake #3 Vertical When writing a new program, start with a draft (VISIO) flow chart, then write the code. Final (VISIO) flow chart required for the written report. Marks will be lost in Lab #2 Report if you don’t follow the rules. Stop mistake #4 8 MECH 452 2010 Lecture #2 (prelab L1 and L2) rev1 mistake #1 where’s the No ? Another VISIO example (Lab #4 with LynxBot) mistake #3 Too many symbols ? mistake #2 missing stop statement 1) Pick partner (and workstation) 2) Sign on “studiolab” (not qlink), password is “ILCP” 3) Download WORD template & programs from web and save to your directory (eg. Group B12) 4) Perform L1 (about 1 hr) 5) Take circuit apart, draft L1 report 6) Perform L2 (about 1 hr) 7) Draft L2 (and submit ?) report 8) Don’t print any report until TA checks it for technical errors 9