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

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

Lab 10 - Role-Playing Game

Lab 4 - Linked Lists

Lab 5 - Linked Lists Git Tag: Lab5Submission

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

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

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

EECE.2160: ECE Application Programming

Lab 7 - Toaster Oven Commit ID Form:

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

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

Computer Science 385 Design and Analysis of Algorithms Siena College Spring Lab 8: Search Trees Due: Start of your next lab session

Lab 6 - Bouncing LEDs Commit ID Form:

14 Data Compression by Huffman Encoding

CpSc 1011 Lab 5 Conditional Statements, Loops, ASCII code, and Redirecting Input Characters and Hurricanes

Lab 9 Battleboats Commit ID Form:

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

CS15100 Lab 7: File compression

Programming Assignment IV Due Monday, November 8 (with an automatic extension until Friday, November 12, noon)

CpSc 1111 Lab 9 2-D Arrays

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

CIS 121 Data Structures and Algorithms with Java Spring 2018

CSE 143: Computer Programming II Spring 2015 HW7: 20 Questions (due Thursday, May 28, :30pm)

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

Programming Assignment IV

Graduate-Credit Programming Project

Hands on Assignment 1

Intermediate Representations

15-122: Principles of Imperative Computation, Spring 2013

Programming Assignment III

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point?

Lab 3. A Multi-Message Reader

Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit

Programming Project II

Magic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

CSCi 4061: Intro to Operating Systems Spring 2017 Instructor: Jon Weissman Assignment 1: Simple Make Due: Feb. 15, 11:55 pm

CpSc 111 Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input

CSE 143: Computer Programming II Summer 2015 HW6: 20 Questions (due Thursday, August 13, :30pm)

CS 4218 Software Testing and Debugging Ack: Tan Shin Hwei for project description formulation

CS450 - Structure of Higher Level Languages

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Figure 1: Graphical representation of a client-server application

CNIT 129S: Securing Web Applications. Ch 12: Attacking Users: Cross-Site Scripting (XSS) Part 2

Cpr E 281 FINAL PROJECT ELECTRICAL AND COMPUTER ENGINEERING IOWA STATE UNIVERSITY. FINAL Project. Objectives. Project Selection

CS131 Compilers: Programming Assignment 2 Due Tuesday, April 4, 2017 at 11:59pm

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

CpSc 1011 Lab 3 Integer Variables, Mathematical Operations, & Redirection

Name EGR 2131 Lab #6 Number Representation and Arithmetic Circuits

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

: Principles of Imperative Computation. Fall Assignment 5: Interfaces, Backtracking Search, Hash Tables

Ch. 3: The C in C++ - Continued -

Overview. Exercise 0: Implementing a Client. Setup and Preparation

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 4

CS 426 Fall Machine Problem 1. Machine Problem 1. CS 426 Compiler Construction Fall Semester 2017

CS 135: Fall Project 2 Simple Cryptography

Project Compiler. CS031 TA Help Session November 28, 2011

CSE143X: Computer Programming I & II Programming Assignment #10 due: Friday, 12/8/17, 11:00 pm

Programming Assignment 0

First Visual Basic Lab Paycheck-V1.0

ECE 154B Spring Project 4. Dual-Issue Superscalar MIPS Processor. Project Checkoff: Friday, June 1 nd, Report Due: Monday, June 4 th, 2018

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Homework 4 (document version 1.1) Sockets and Server Programming using C

Cindex 3.0 for Windows. Release Notes

Boot Camp. Dave Eckhardt Bruce Maggs

Compilers. Intermediate representations and code generation. Yannis Smaragdakis, U. Athens (original slides by Sam

EECE.2160: ECE Application Programming

USING UPB LIGHTING DEVICES WITH HOMEVISION OR HOMEVISION-PRO

Programming Assignment 1

MP 3 A Lexer for MiniJava

CMPSCI 240 Reasoning Under Uncertainty Homework 4

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

Programming Tips for CS758/858

Check the spelling of the worksheet by using Excel s spelling check feature.

CS4450. Computer Networks: Architecture and Protocols. Lecture 13 THE Internet Protocol. Spring 2018 Rachit Agarwal

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

ASD:Suite - Code Generation 2013 Verum 1

Overview. Exercise 0: Implementing a Client. Setup and Preparation

CS 2604 Minor Project 1 DRAFT Fall 2000

Project 3: RPN Calculator

UPB US1-40 Single Rocker Wall Switch with Dimmer Firmware Specification

COMP2121 Introductory Experiment

Digital Fundamentals

Final Programming Project

15-110: Principles of Computing, Spring 2018

a f b e c d Figure 1 Figure 2 Figure 3

Assignment 1: Plz Tell Me My Password

p1: Fortune 1. Overview 2. Learning Goals 3. Logistics 4. Linux commands

CMSC 201 Fall 2018 Lab 04 While Loops

CDA 3101: Summer 2018 Project 2 - Pipeline Simulator

CS 2316 Pair 1: Homework 3 Enigma Fun Due: Wednesday, February 1st, before 11:55 PM Out of 100 points

Switch between simple Date arrangement and Date (Conversations)

Word: Print Address Labels Using Mail Merge

Interrupt handling. Purpose. Interrupts. Computer Organization

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

Ascii Art. CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points

HOT-Compilation: Garbage Collection

CS159 - Assignment 2b

Programming Fundamentals

TESTING AND DEBUGGING

Project Data: Manipulating Bits

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz I Solutions

Transcription:

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO PROGRAMMING IN C SPRING 2011 Lab 8 Morse code Introduction Reading This lab will perform Morse code decoding and encoding using the terminal, LCD, and push buttons on the Explorer 16 board. Working implementations of both the linked list and LCD libraries will be provided along with a pushbuttons library for you. Morse code article on Wikipedia Event-driven programming handout Provided files MorseTranscoder.h This file contains the API that you will be implementing in the aptly named MorseTranscoder.c file. It will use a Morse tree to decode Morse code strings. Encoding functionality is also provided. MorseEvents.h - This file includes a single function that will check the buttons for the various Morse code characters. Lab8SupportLib.a (Lcd.h, LcdDriver.h, Timers.h, LinkedList.h, Buttons.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. lab8.c - This file includes main() where you will implement the bulk of this lab's functionality. Please note the macro ReceivedInput() that you should use to read input a single character at a time over the terminal. Assignment requirements Morse code library: Implement all of the functions defined in MorseEvents.h and MorseTranscode.h. o Morse code input must be decoded using a Morse tree implemented on top of a linked list (using the functions in LinkedList.h). o The library should encode all alphanumeric characters ([0-9A-Za-z]) o It should decode all alphanumeric characters, representing alphabetic characters as only their upper-case representation. main(): Your main() within lab8.c must implement the following functionality using the provided code along with your Morse code library.

o User input must be read from the terminal. Each character received should be output back to the screen along with its Morse code representation (using '.'s and '-'s). The support code for this lab does not automatically echo the characters that are typed into the terminal. Invalid input should be output to the terminal in both its character and numeric representation stating that it's an invalid character. o User input is also captured by the 4 push buttons on the Explorer 16 board: S3, S6, S5, and S4. These will correspond to a DOT, DASH, CHARACTER_SPACE, and a WORD_SPACE respectively when pressed. The user can input DOTs and DASHes via the push buttons to specify a the Morse code representation of an alphanumeric character. These are shown on the bottom line of the LCD as they're entered. Pressing the CHARACTER_SPACE button attempts decoding of the inputted DOTs and DASHes when pressed. The bottom line is cleared and the character is decoded. If it is a valid character it is appended to the end of the top line. If it is invalid a '#' is appended instead. Once the top line is full of characters, it should be shifted left to make room for next character to be displayed giving the appearance of it scrolling as new characters arrive. The WORD_SPACE button signifies the end of a word and appends a space (' ') to the end of the top line. It also clears the bottom line and ignores the previous user input if there was any. 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 The names of colleagues who you have collaborated with Submission: o Submit your Morse code library, named MorseTranscode.c and "MorseEvents.c" along with your main program, named lab8.c, via ecommons before the due date (double check that it was accepted, again BEFORE the due date). Grading This assignment again consists of 10 points: 5 points Morse code library functionality as outlined in MorseEvents.h and MorseTranscoder.h

4 points The rest of the lab functionality 1 point Code is correctly formatted with good comments and variable names You will lose points for the following: -10 points: Code doesn t compile -2 points: Compilation produces warnings -2 points: Files besides MorseTranscode.c, MorseEvents.c, and lab8.c were submitted. -2 points: Files don't contain the appropriate comments with your name (and collaborators if any) at the top of every submitted file -2 points: gotos were used Example output Morse tree Morse code is represented by 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 representable 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 below.

So given the tree above, decoding a Morse string involves starting at the root of the tree and branching left or right depending on what character is next in the string until all the characters have been read. The node that you end up on 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 '-..'. Trees from linked lists Now it would be a pain to write another data structure library for representing a binary tree just to decode a Morse string. Luckily you have already implemented a doublylinked list, a data structure that relies on nodes having two links to other nodes. As that is exactly what a binary tree requires, you can implement this binary tree on top of the linked list you implemented for earlier labs. Since the linked list implementation you already wrote wasn't designed to support a tree-like data structure, this is going to be a little tricky to do. You will need to create a series of ListItems to be the nodes in the tree. After you have these nodes properly created and pointing to the correct data (the ASCII characters they represent) the points to the previousitem and nextitem will need to be manually rearranged into the Morse tree. This is a conceptually complicated task and easy to get wrong. It will be best to think about how this will be done and write it out in pseudo-code before starting. Debugging this portion of the lab will be difficult and it will be easier to have correct pseudo-code before starting to write the actual code.

Event-driven programming This lab will rely heavily on event-driven programming. Specifically the events that are important in this lab will be those generated by the functions in Buttons.h, MorseEvents.h, and from user input from the terminal (received via the macro ReceivedInput()). The Timers.h library has been provided as a way to repeatedly call these event checkers in the background. While the event checkers are continuously called in the background via the Timers.h library, the main program loop within main() will respond to these events with the appropriate service routines. Also be sure to clear the event flags when the service routines finish or the event will be continuously triggered!