UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE-13/L: COMPUTER SYSTEMS AND C PROGRAMMING WINTER 2014

Similar documents
UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO PROGRAMMING IN C SPRING 2011.

Lab 10 - Role-Playing Game

Lab 7 - Toaster Oven Commit ID Form:

Lab 4 - Linked Lists

Lab 10 - Role-Playing Game Git Commit ID Form:

Lab 5 - Linked Lists Git Tag: Lab5Submission

Lab 9 Battleboats Commit ID Form:

Lab 6 - Bouncing LEDs Commit ID Form:

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO PROGRAMMING IN C SPRING 2013

CS 215 Fundamentals of Programming II Fall 2017 Project 7. Morse Code. 30 points. Out: November 20, 2017 Due: December 4, 2017 (Monday) a n m

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING

Out: April 19, 2017 Due: April 26, 2017 (Wednesday, Reading/Study Day, no late work accepted after Friday)

It is academic misconduct to share your work with others in any form including posting it on publicly accessible web sites, such as GitHub.

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

CSE 340 Fall 2014 Project 4

Programming Assignment IV Due Thursday, November 18th, 2010 at 11:59 PM

Recitation #12 Malloc Lab - Part 2. November 14th, 2017

PROBLEM SOLVING AND OFFICE AUTOMATION. A Program consists of a series of instruction that a computer processes to perform the required operation.

CS3 Midterm 1 Fall 2006

Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time)

CS 3114 Data Structures and Algorithms DRAFT Project 2: BST Generic

15-122: Principles of Imperative Computation, Spring 2013

ECE2049: Embedded Systems in Engineering Design Lab Exercise #3 C Term Making a Time and Temperature Display

Project Compiler. CS031 TA Help Session November 28, 2011

The first time you open Word

CDA 3101: Summer 2018 Project 2 - Pipeline Simulator

Lab 1 Implementing a Simon Says Game

a) Do exercise (5th Edition Patterson & Hennessy). Note: Branches are calculated in the execution stage.

EECE.2160: ECE Application Programming

CS3114 (Fall 2013) PROGRAMMING ASSIGNMENT #2 Due Tuesday, October 11:00 PM for 100 points Due Monday, October 11:00 PM for 10 point bonus

Lesson Plan. Week Theory Practical. Lecture Day Topic(including assignment Test) Practical Day

Recitation #11 Malloc Lab. November 7th, 2017


MPATE-GE 2618: C Programming for Music Technology. Syllabus

Tips from the experts: How to waste a lot of time on this assignment

CS 553 Compiler Construction Fall 2009 Project #1 Adding doubles to MiniJava Due September 8, 2009

Programming Assignment IV Due Thursday, June 1, 2017 at 11:59pm

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Malloc Lab & Midterm Solutions. Recitation 11: Tuesday: 11/08/2016

Tips from the experts: How to waste a lot of time on this assignment

CS02b Project 2 String compression with Huffman trees

CpSc 1111 Lab 9 2-D Arrays

COMP-520 GoLite Tutorial

Assignment 3 ITCS-6010/8010: Cloud Computing for Data Analysis

Cosc 242 Assignment. Due: 4pm Friday September 15 th 2017

Lab 1: Dynamic Memory: Heap Manager

CS ) PROGRAMMING ASSIGNMENT 11:00 PM 11:00 PM

Programming Assignment Multi-Threading and Debugging 2

CS451 - Assignment 3 Perceptron Learning Algorithm

CS 2704 Project 2: Elevator Simulation Fall 1999

Problem Set 6 Audio Programming Out of 40 points. All parts due at 8pm on Thursday, November 29, 2012

CS2110 Assignment 2 Lists, Induction, Recursion and Parsing, Summer

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Learning to Program with Haiku

ENCE 3241 Data Lab. 60 points Due February 19, 2010, by 11:59 PM

KU Compilerbau - Programming Assignment

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website:

Documentation Nick Parlante, 1996.Free for non-commerical use.

Software Testing for Developer Development Testing. Duvan Luong, Ph.D. Operational Excellence Networks

Assignment 4 CSE 517: Natural Language Processing

CS52 - Assignment 8. Due Friday 4/15 at 5:00pm.

CS159 - Assignment 2b

Microsoft Office Word 2010

Creating a String Data Type in C

Practical C++ Programming

Graduate-Credit Programming Project

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

CS Homework 10 p. 1. CS Homework 10

COMP251: Algorithms and Data Structures. Jérôme Waldispühl School of Computer Science McGill University

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode

A Bison Manual. You build a text file of the production (format in the next section); traditionally this file ends in.y, although bison doesn t care.

CS 051 Homework Laboratory #2

TOTAL ECLIPSE POCKET GUIDE CONTENTS

Lab 1 Implementing a Simon Says Game

Programming Project 4: COOL Code Generation

PowerPoint Instructions

Announcements. The current topic: Scheme. Review: BST functions. Review: Representing trees in Scheme. Reminder: Lab 2 is due on Monday at 10:30 am.

Data Structure and Algorithm Homework #3 Due: 2:20pm, Tuesday, April 9, 2013 TA === Homework submission instructions ===

UNIVERSITY OF MASSACHUSETTS LOWELL Department of Electrical and Computer Engineering. Program 8 EECE.3220 Data Structures Fall 2017

COP 3014: Fall 2017 Homework 4

Project 4: Implementing Malloc Introduction & Problem statement

MLA Style: Step-By-Step Instructions

Lab 8 - Vectors, and Debugging. Directions

CSE351 Winter 2016, Final Examination March 16, 2016

CS 553 Compiler Construction Fall 2006 Project #4 Garbage Collection Due November 27, 2005

Welcome to Lab! You do not need to keep the same partner from last lab. We will come around checking your prelabs after we introduce the lab

CS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation

ESC101N: Fundamentals of Computing End-sem st semester

Course Planning for University-Grade Curricula

Advanced Algorithms: Project

COMP 202 Java in one week

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department

CS 406/534 Compiler Construction Putting It All Together

Compiler Design: Lab 3 Fall 2009

Project 3: RPN Calculator

Data Networks Project 3: Implementing Intra-Domain Routing Protocols

Remaining Enhanced Labs

Programming Assignment 8 ( 100 Points )

Basic Microsoft Word

Transcription:

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE-13/L: COMPUTER SYSTEMS AND C PROGRAMMING WINTER 2014 Lab 7 - Morse Code Introduction This lab involves Morse code decoding and encoding using the terminal, OLED, and push buttons on the Basic I/O Shield. Working implementations of the OLED and Buttons libraries are provided for you. This lab builds on your previous experience with eventdriven programming and state machines and expands that to the binary tree data structure and light recursion. Reading Concepts Morse code article on Wikipedia Pointers Timers Finite state machines Abstract Data Type: Binary trees Recursion Provided files Morse.h This file contains the API that you will be implementing in the aptly named Morse.c file. It will use a Morse tree to decode Morse code strings. Encoding functionality is also provided. Tree.h This file declares an interface for creating and working with binary trees. You will be implementing the corresponding Tree.c file. Lab7SupportLib.a (Buttons.h, Common.h, Oled.h) These files provide helper functions that you will need to use within your code. The header files contain comments that should clarify how the code is to be used. lab7.c - This file includes main() where you will implement the bulk of this lab's functionality. You will not have access to the serial port in this lab so plan on using breakpoints for debugging! Assignment requirements

For this lab you will need to create your own iterative-design plan. You must have this done and on hand to get help from a TA/tutor. Specifically you should be able to show where you are in your development process on this plan. IMPORTANT! Name partner for next lab (1 point): The next lab is a partnered lab, so you will need to add the name of your partner to your README.txt document. Your partner will need to do the same for you to get this point. Binary tree library: Implement the functions defined in Tree.h in a corresponding Tree.c. o All functions must use recursion when traversing the tree. o Any constants used must be declared as an enum type or #defined. o No user input/output should be done within this library! Morse code library: Implement all of the functions defined in Morse.h. o Morse code input must be decoded using a Morse tree implemented using the functionality of Tree.h. o It should decode all alphanumeric characters, representing alphabetic characters as only their upper-case representation. o All constants and enums in Morse.h must be used and cannot be redeclared in Morse.c. o Any additional constants used must be declared as an enum type or #defined. o No user input/output should be done within this library! main(): Your main() within lab7.c must implement the following functionality using the provided code and your Morse code library. o Initialize the Morse decoder and check its return value printing out an error message if and calling FATAL_ERROR() if it fails. o Use Timer2's ISR to check for both the button events and the Morse events. o There should be no terminal input or output. o Capture events from BTN4 via the Buttons.h library that you have already used. The length of time this button is held down or released will indicate if a DOT, DASH, END_CHAR, or a SPACE are input. The user can input DOTs and DASHes by varying how long they press down BTN4 to specify the Morse code representation of an alphanumeric character. These are shown on the bottom line of the OLED as they're entered. If the button is unpressed for [0.3s, 0.7s), it signals the end of decoding an alphanumeric character. The top line of the OLED should be cleared. The decoded character (or '#' if the character was invalid) should be appended to the end of the characters shown on the 2nd line. Once the 2nd line hits OLED_CHARS_PER_LINE then it is fine if no more characters can

o be displayed. The extra credit fixes this, so implement that if it bothers you. A blank space character can be decoded by leaving BTN4 unpressed for [0.7s,1.5s). This signifies the end of a decoded word and appends a space (' ') to the end of the 2nd line along with clearing the top line. If there was previous user input of DOTs or DASHes, they are ignored. malloc() (or calloc()) will be used in this lab to generate the Morse tree, so add a comment at the top of the lab7.c file indicating the necessary heap size for correct program functionality. Extra Credit (1 point): Once the 2nd line is full of characters, new characters should be appended to the 3rd row and then the 4th. Once there is no more room on the 4th row, new characters should appear at the last position on the 4th row and the first character in the 2nd row should be pushed off to the left. The 2nd through 4th rows should shift left to accommodate. Code style: Follow the standard style formatting procedures for syntax, variable names, and comments. o Add the following to the top of every file you submit as comments: Your name o The names of colleagues who you have collaborated with Readme: Create a file named README.txt containing the following items. Note that spelling and grammar count as part of your grade so you'll want to proofread this before submitting. This will follow the same rough outline as a lab report for a regular science class. It should be on the order of three paragraphs with several sentences in each paragraph. o First you should list your name, your partners name, and the names of anyone else who you have collaborated with. NOTE: collaboration!= copying o In the next section you should provide a summary of the lab in your own words. Highlight what you thought were the important aspects of the lab. If these differ from how the lab manual presents things, make a note of that. o The following section should describe your approach to the lab. What was your general approach to the lab? Did you read the manual first or what were your first steps? What went wrong as you worked through it? What worked well? How would you approach this lab differently if you were to do it again? Did you work with anyone else in the class? How did you work with them and what did you find helpful/unhelpful? o The final section should describe the results of you implementing the lab. How did it end up finally? How many hours did you end up spending on it? What'd you like about it? What did you dislike? Was this a

Grading worthwhile lab? Do you have any suggestions for altering it to make it better? What were the hardest parts of it? Did the points distribution for the grading seem appropriate? Did the lab manual cover the material in enough detail to start you off? Did examples or discussions during class help your understand this lab or would more teaching on the concepts in this lab help? Submission: o Submit Morse.c, Tree.c, README.txt, and lab7.c before the deadline. Morse tree This assignment consists of 15 points: 2 points Binary tree functionality as outlines in Tree.h 4 points Morse code library functionality as outlined in Morse.h 5 points Input/output functionality in lab7.c 1 point - Timer implemented correctly 1 point - Provided a README.txt 1 point - Named partner for the next lab. 1 point Coding and style guidelines were followed with < 6 errors in all source files. You will lose points for the following: NO CREDIT for sections where required code didn't compile -2 points: Compilation produces warnings -2 points: gotos were used -1 point: The used heap size for your project was not specified at the top of lab7.c Morse code is a representation of the standard English alphabet via a sequence of dots and dashes. Because there can only be dots and dashes for representing a single character, a binary tree can store the patterns for all the characters that can be encoded

Binary trees Recursion by Morse code. While there are Morse code representations for many characters in many languages, this lab focuses on only the alphanumeric characters within the ASCII character set. A Morse tree with those characters in them is shown above. So given this tree, decoding a Morse string involves traversing the tree starting at its root. Either left or right branch is taken depending on what character is next in the string until all the characters have been read. The node that you end up at is the character that the Morse string represented. For example, to decode "-.." you first start at the root node. The first character in the Morse string is a dash, so you branch to the right to the T node. The next two characters are then both dots and so you branch left twice going through the N node and ending on 'D', which is the alphanumeric character represented by the Morse string '-..'. The function MorseInit() is where you will initialize your own Morse tree. Make sure that you only initialize just the necessary number of nodes, specifically only those indicated by the above Morse tree diagram. Note that MorseInit() may not be able to fail depending on how you implement the generation of your Morse tree. A binary tree is a common data structure used in programming, with the Morse tree depicted early is shown using a binary tree. The term "binary" refers to the number of children allowed for each node, in this case 2 (ternary trees are also common and they have 3 children per node). The binary tree library that you will implement stores a single character in each node within the tree and only allows for perfect binary trees. Perfect binary trees are trees in which all levels of the tree are full. This means that the tree has 2 levels - 1 nodes. It should be noted that a Morse tree is not a perfect tree, it isn't even a packed, full, or complete tree. This means that you will need to account for this discrepancy when using the Tree library within your Morse one. With binary trees, or in fact trees of any type, recursion is a concept that generally comes up. The concept of recursion relies on an action that can be reduced to a base case and an operation that can reduce all other cases to this base case. What this means generally in programming is that you can have a function call itself with slightly different parameters to perform all desired actions necessary. Wikipedia has a quite thorough description of recursion that would be a good starting point, though I recommend jumping directly to the examples section. Event-driven programming

This lab again relies on the event-driven programming paradigm. The events that are important in this lab will be those generated by the Morse library, which in turn relies on the Buttons library. An interrupt for Timer 2, which triggers every 100Hz, has been provided as a way to repeatedly call the Buttons and MorseEvents event checkers in the background. Morse State Machine In this lab you will again implement a state machine. In this case the state machine is very simple, only 2 states, and is necessary handle timing with the button presses. The state machine diagram below illustrates how to implement the MorseCheckEvents() function to convert button events into Morse events. Iterative Design Plan Since you will be implementing from a state machine, the general way to implement this is to implement one state transition at a time. By starting with the display functionality in this lab, being able to confirm state transitions will be simple because then you can just view the OLED. We have not provided an iterative design plan because you should be comfortable approaching these labs and getting started. If you are not, please see the professor or TA/tutor for help in planning on how to start this lab. Making an iterative design plan is worthwhile as these labs can be complicated and focusing on a specific feature to implement will make sure you can still move forward, one feature at a time.