ENCM511 Assignment 1 Version 16 September 2012

Size: px
Start display at page:

Download "ENCM511 Assignment 1 Version 16 September 2012"

Transcription

1 ENCM511 Assignment 1 Version 16 September 2012 This is an individual assignment, essentially a take home quiz. This means the purpose behind this assignment is for YOU to show the skills learnt during the familiarization laboratory (Section 2, 18 th September, Section 1, 25 th September). This assignment is due two weeks after your lab. HINT READ ALL THE REQUIREMENTS BEFORE STARTING ANY CODING There are a lot of useful code samples that will help speed up your coding. Demonstrate A) Demonstrate your ability to develop a VDSP project, write code and run a Blackfin executable on the BF533 Board B) Demonstrate your ability to write and run a short program that activates a single LED on the board C) Demonstrate your ability to run a short program that activates singles LEDs in a given order with a time delay between activations D) The ability to write and run a short program that activates multiple LEDs at the same time using a super loop controller (You are REQUIRED to demonstrate the use of C++ bit wise AND and OR operations to control the LED embedded interface). NOTE: IF you want to put all the marks for part D into part F and concentrate on audio analysis program okay by me but let me know you plan to do that. E) The ability to write some simple tests to check the functions you develop F) Building a mock Audio Analysis program on the Blackfin Board for the Ranchlands Hum (see lik on ENCM511 webpage). MARKS 15% OF ASSIGNMENT (MEANING YOU CAN GET AN A WITHOUT DOING THIS PART. BASICALLY ITS THERE FOR A LITTLE BIT OF FUN NOT REALLY NEEDED BUT IDEAS SHOULD BE THOUGHT ABOUT AS WOULD MAKE EXCELLENT QUIZ OR MIDTERM QUESTIONS. G) Provide (hand in) documented code prepared according the requirements of this course. Work will not be marked if the front page of the report does not include a signed declaration that this is your own work, and that you have followed the Smith 20 minute Rule in seeking assistance from others. Explain the 20 minute rule as part of your declaration. Early bird hand in date Sunday 30 th September. Section 2; Sunday 7 Oct. Section 1. There is a 10% bonus for handing in Assignment 1 by this early due date. Last date to hand in Assignment 1 Sunday 7 Oct. Section 2; Sunday 14 Oct. Section 1. NO FURTHER EXTENSION. Assignment 1 demos will start during the Lab periods (4 pm to 5 pm) following 7 th October for Section 2 and after 14 th October for Section 1. Be prepared to demonstrate using code in your own directory at 15 minutes notice.

2 INITIAL INSTRUCTIONS ASSIGNMENT 1 PART A Demonstrate the ability to develop your own VDSP project (.prj), write code and run a Blackfin executable (.dxe) on the BF533 Board In the Familarization Laboratory, you developed various LED functions. You are going to reuse those ideas in this Assignment. During Lab. 0, you downloaded the following OBJECT files from ENCM511 Familiarization Laboratory website into your ENCM511 / Familiarization directory. NOTE: Actual names might be different in minor ways; demonstrate your ability to modify the project to handle this situation DrSmith_LEDDeviceDriverCPP.doj, LEDReadWriteCPP.doj and DrSmith_WaitForKeyBoardEntryCPP.doj In your ENCM511 / Assignment 1 directory, build a project called ActivateSingleLED_Keyboard.dpj ADD all the doj files downloaded into the Familiarization directory to this project. NOTE: This means demonstrate how to add existing files to a project. It does not mean copy the files in the Familiarization directory into the new Assignment 1 directory. Add the following assignment1.h INCLUDE file to your Assignment 1 directory. Another name used for this sort of file is header file means the same thing, different stress on the functionality behind using the file. #ifndef ASSIGNMENT1_H #define ASSIGNMENT1_H #include <stdio.h> void InitFlashCPP(void); // Initialize EBIU interface (Dr. Smith version) PROVIDED void InitFlashPortCPP(void); // Initialize Flash port used to control LED PROVIDED extern C void StartProcessorCycleCounter(void); // Clear and Start cycle counter PROVIDED extern C unsigned long long int ReadCurrentProcessorCycleCount(void); // Return (64 bit) values of Blackfin Cycle Counter PROVIDED unsigned int ReadFlashLEDASM(void); void WriteFlashLEDASM(unsigned int LEDvalue); // Read current state of LED output register PROVIDED // Write new state to LED output register PROVIDED void DrSmith_WaitForKeyBoardEntry(void); // Press return to continue PROVIDED void LEDLoop_WithKeyBoardWait(unsigned int LEDinfo[ ], int lengthledinfo); // Displays series of LED values PROVIDED void LEDLoop_WithTimedWait(unsigned int LEDinfo[ ], int lengthledinfo, int waitthistimeinseconds); // THIS IS JUST THE PROTOTYPE // Displays series of LED valuesautomaically THE CODE IS FOR YOU TO WRITE void LEDShow_MyFirstNameInitial(void); void LEDShow_MySurnameFirstLetter(void); // THIS IS JUST THE PROTOTYPE THE CODE IS FOR YOU TO WRITE // THIS IS JUST THE PROTOTYPE THE CODE IS FOR YOU TO WRITE void WaitThisNumberOfTenthsOfSecond(unsigned int numberoftenthsofsecond); // THIS IS JUST THE PROTOTYPE THE CODE IS FOR YOU TO WRITE #endif

3 Add the following ActivateSingleLED_Keyboard_mainCPP.cpp SOURCE file to your directory DO A CODE REVIEW AND REMOVE DELIBERATE (and some accidental) TYPOS. o Expect to have to do a code review on all the source files I give you in the lab and assignments. If I just let people download and use the files, they will never learn the material for the course. Note the code behind the.doj files is hidden to you. #include../assignment1/assignment1.h void main(void) { LEDShow_MyFirstNameInitial( ); // When all the code is complete, this function will not work if called at this point in the code // Add comments to your code to explain why DrSmith_WaitForKeyBoardEntry( ); // Stops the program and gives you time to examine the LED output InitFlashCPP( ); InitFlashPortCPP( ); LEDShow_MySurnameFirstLetter( ); // This function should now work Add comments to your code to explain why DrSmithWaitForKeyBoardentry( ); // Stops the program and gives you time to examine the LED output LEDShow_MyFirstNameInitial( ); DrSmithWaitForKeyBoardEntry( ); // This should now work unsigned int LEDcontrolFirstArray[5] = { 0x3F, 0x3F, 0x33, 0x37, 0x21, 0x22, 0x00, 0x00; // Turn on a number of LEDs should look like the shuttle door on the Voyager opening LEDLoop_WithKeyBoardWait(LEDcontroFirstlArray, 5); // Add your own function call to make the LEDs look like a shuttle door closing printf( Done assignment 1 A\n ); If you now build this project, you will get error messages from the LINKER about not finding the LEDShow_MyFirstNameInitial( ) and LEDShow_MySurnameFirstLetter( ) routines. As discussed in class, add missing functions as stubs to allow the project to build, link and load. STUBS MEANS NO CODE OTHER THAN WHAT IS NEEDED TO SATISFY THE COMPILER. If you now run the code, then after 3 presses of the enter key, you should see the LED light up with the bits that look like the Voyager Shuttle bay opening. You can easily add additional the code so that the lights move from left to right This represents the shuttle moving into the shuttle bay, and then more code to close the shuttle doors Total amount of code needed 4 lines of C++ added to the main.cpp code. ASSIGNMENT 1 PART B Demonstrate the ability to write and run a short program that activates a single LED s on the board In another.cpp file, you are now to write the code for LEDShow_MyFirstNameInitial( ) and LEDShow_MySurnameFirstLetter( ), Each of these CPP functions require about 3 lines of code using the functions you already have put into the project My last name is Smith the ascii code for the letter S can be automatically generated in C++ by using the symbol S (meaning the character S ). Thus if I write the code WriteFlashLEDASM( S ) I would expect to see the ascii bit pattern for the letter S appearing on the screen.

4 HAND IN YOUR C++ CODE FOR THESE TWO FUNCTIONS (Actually I have been told that since these functions don t return anything (return void) they are subroutines. These days you can have a function that returns void pointers (capable of being used to point to any type of variable so why can t you have a function that return a void value ). PROVIDE A SCREEN CAPTURE TO DEMONSTRATE THE SOURCE FILES LINKED TO YOUR PROJECT AND THE FACT THAT THE PROJECT COMPILED, LINKED AND DOWNLOADED WITHOUT ERROR EVEN BEFORE ALL THE FUNCTIONS FOR THE ABOVE CODE HAVE BEEN WRITTEN, IT IS POSSIBLE TO EXPLAIN AT THE HARDWARE AND SOFTWARE LEVEL WHY (A) THE CALL to LEDShow_MyFirstNameInitial( ) IN THE ABOVE CODE SHOULD NOT BE EXPECTED TO WORK THE FIRST TIME IT IS CALLED, WORK THE SECOND TIME IT IS CALLED IN THE SAME PROJECT CODE, AND (B) WHY YOU WOULD EXPECT THE BOTH CALLS TO FUNCTION TO WORK IF YOU RERAN THE CODE AND (C) THIS BEHAVIOUR GOES BACK TO NOT RUNNING THE FIRST TIME IF YOU DOWNLOAD THE EXECUTABLE TO THE BOARD A SECOND TIME. GIVE (D) THE ASCII HEX VALUES FOR YOUR FIRST NAME INITIAL, (E) WHAT YOU EXPECTED TO SEE IN THE LED LIGHTS AFTER RUNNING THE CODE LEDShow_MyFirstNameInitial( ), (F) WHAT YOU ACTUALLY SAW, AND (G) IF DIFFERENT, WHY THE DIFFERENCE (H) GIVE THE ASCII HEX VALUES FOR YOUR SURNAME FIRST LETTER, (I) WHAT YOU EXPECTED TO SEE IN THE LED LIGHTS AFTER RUNNING THE CODE LEDShow_MySurnameFirstLetter( ), (J) WHAT YOU ACTUALLY SAW, AND (K) IF DIFFERENT, WHY THE DIFFERENCE ASSIGNMENT 1 PART C Demonstrate the ability to write and run a short program that activates singles LED s in a given order with a time delay between activations In your ENCM511 / Assignment directory, build a project called ActivateSingleLED_Timed.dpj o Yes, you can have more than one project file in a directory. It s not a great idea unless all the projects are just minor variations of each other. To this project, add all the doj files downloaded into the Assignment 1 directory and also the assignment1.h include file with all the common subroutine and function prototypes. Remember ADD the files to the projects. There is no need to make extra copies. You will need to write this function void WaitThisNumberOfTenthsOfSecond(int numberoftenthsofsecond); // 12 lines of code Suppose you had this subroutine working, and then wrote some C++ code that looked roughly like the following pseudocode. WriteLEDASM(1) // Pseudo code is roughly like C++ WaitThisNumberOfTenthsOfSecond(10); // but not worrying about exact syntax WriteLEDASM(2) WaitThisNumberOfTenthsOfSecond(20); // Pseudo code expresses ideas not syntax WriteLEDASM(1) // so missing semi colons is okay here but not in straight code WaitThisNumberOfTenthsOfSecond(5); WriteLEDASM(0)

5 This sequence of calls would cause LED 1 to stay on for 1 second and then be replaced by LED 2 being on, and then 2 second later, LED 1 would come on again, before all LED s are turned off. I have provided you with two functions to help you write this code inside the object file CycleCountASM.doj, JUST USE THEM; How do they work worry about it later WAIL!. extern C void StartProcessorCycleCounter(void); // Clear and Start cycle counter extern C unsigned long long int ReadCurrentProcessorCycleCount(void); // Return (64 bit) values of Blackfin Cycle Counter Remember that the processor clock has a frequency of 500 MHz (roughly). NOTE: My test board actually had a clock frequency of 200 MHz as I had switched it into power saving mode. Do a rough check that your lights are flashing at 1 second intervals using a stop watch 10% accuracy is good enough as long as all the lights have equivalent timing. You can t have one light flashing at 1.1 secs and the other at 0.9. Will discuss power saving mode in class later. Now you need to write the routine void LEDLoop_WithTimedWait(unsigned int LEDinfo[ ], int lengthledinfo, int waitthistimeinseconds); // 6 lines of code where the requirements are Display on the LED all the bit patterns associated stored in the array LEDinfo[ ]; changing the LED image at intervals of waitthistimeinseconds which is timed by calling the routine WaitThisNumberOfTenthsOfSecond( ). Program the code so that the number of seconds between the LED image changes is equal to the number of letters in your last name. (Hint try it with a pretend name of 2 letters; once working change it to the proper timing.) (A) HAND IN YOUR C++ CODE AND A SCREEN DUMP SHOWING THAT THIS CODE COMPILED, LINKED AND LOADED (B) FIND A PERSON (NOT YOUR LAB PARTNER) WHOSE HAS A SURNAME WHOSE INITIAL IS NOT THE SAME AS YOURS, BUT IS + 3 LETTERS FROM YOUR INITIAL. (C) HAVE THEM COME IN AND SIGN OFF ON YOUR CODE TO SAY IT IS WORKING. (D) 5% BONUS IF YOU CAN SHOW THAT PERSON HOW TO CHANGE THE ARRAY, SO THAT THE LIGHTS FLASH UP AND THEN FLASH DOWN LIKE THE LIGHTS ON A ZYLON HEAD BAND (Battlestar Galatica), then compile, load and run the code. (E) You will need a third person to sign off on the correct working of this code. HAND IN THIS CODE

6 ASSIGNMENT 1 PART D Demonstrate the ability to write and run a short program that activates multiple LEDs at the same time using a super loop controller. In this part of the assignment you will need to demonstrate the use of C++ bitwise AND and OR operations to control the LED embedded interface. NOTE: IF you want to put all the marks for part D into part F and concentrate on building the video game okay by me but it s on your head. A super loop looks like this main( ) { InitInterfaces( ); while (1) { // The super loop YOUR CODE HERE TO CONTROL THE INTERFACE GOES HERE ( ) See various example pieces of code The requirements are the following Using bit wise C++ AND and OR instructions write the code for a function void ChangeLEDLight(unsigned int whichled, bool on_off); which turns the LED whichled on or off, leaving the other LEDs not selected unchanged Example: Suppose the LED pattern was % (The symbol % is used to show that these are binary bits it does not mean take modulus In C you would have to write 0x15) ChangeLEDLight(1, 0) ChangeLEDLight(2, 1) would leave the LED pattern as % Using ChangeLEDLight(3, 1) ChangeLEDLight(4, 0) would leave the LED pattern as % but ChangeLEDLight(3, 0) ChangeLEDLight(4, 1) would give the LED pattern as %

7 Now, using the super loop implement the following requirements using ChangeLEDLight( ) and ReadCurrentProcessorCycleCount LED 1 toggles every 0.75 seconds toggles means on then off every 0.75 seconds (50% duty cycle) LED 3 toggles every 2.5 seconds LED 5 does not do anything for 4.5 seconds and then toggles every 3 seconds for 12 seconds and then stops for 5 seconds then starts this pattern all over again Example of a super loop task is given at the end of the assignment HAND IN YOUR CODE with screen dumps HAVE SOMEBODY SIGN OFF THAT IT WORKS ARRANGE TO DEMONSTRATE TO A T.A. OR MYSELF BIG PROBLEM How can you wait for 0.75 seconds on one light when you are already waiting for another light for 2 seconds? Light 1 flashes every 1 second Code : for ever { Wait 1 second; toggle Light 1 Light 1 flashes every 1 second; Light 2 flashes every 2 seconds Code : for ever { Wait 1 second; toggle Light 1 Wait 2 seconds; toggle Light 2 DOES NOT WORK Code : for ever { Wait 1 second; toggle Light 1; Wait 1 second Wait 1 seconds; toggle Light 1 ; toggle Light 2 WORKS BUT UGLY CODE WITH SIX LIGHTS AND WEIRD TIME INTERVALS Better code for more details see later pages for more explanations around using a superloop For ever { if (timenow( ) >= nexttimeforled1) { // Put a comment in your code to explain why use == is not a good idea. Toggle LED 1; nexttimeforled1 + = 1 second if (timenow( ) >= nexttimeforled2) { Toggle LED 2; nexttimeforled2 + = 2 second

8 ASSIGNMENT 1 PART E Demonstrate the ability to write some simple tests to check the functions you develop Make a project in your Assignment1_Test directory and use the EmbeddedUnit GUI to make it an Embedded Unit test project Write the test code to demonstrate that ChangeLEDLight( ) works correctly. HAND IN YOUR CODE with screen dumps HAVE SOMEBODY SIGN OFF THAT IT WORKS How many tests should I write? The answer enough! Knowing how many tests to write is one of the key issues in testing. Write too few, and the company loses a lot of money as the code is returned for fixing in your company s case, too low an assignment mark now, and a lot of time fixing the code so it can be re used in the next assignment or lab Write too many, and the company loses money as the code is never released, or released after somebody else has released and equivalent product. In your case, you waste time you could have spent socializing or completing another assignment Discuss this with one of the software engineering students ask about Partitioning ASSIGNMENT 1 PART F PRATICAL APPLICATION OF THESE IDEAS 15 % OF ASSIGNMENT (MEANING YOU CAN GET AN A WITHOUT DOING THIS PART) BASICALLY ITS THERE FOR A LITTLE BIT OF FUN NOT REALLY NEEDED BUT IDEAS SHOULD BE THOUGHT ABOUT AS WOULD MAKE EXCELLENT QUIZ OR MIDTERM QUESTIONS) Read the one page abstract Solving Health Issues Associated with Urban Low Frequency Noise Irritants by E. Marasco and M. Smith to give you the idea of the problem associated with the Calgary Ranchland s Hum Develop a project Mock_Ranchlands_Hum that fakes a super loop program that monitors houses to see if the 40 Hz Hum is present. We will mock the situation by pretending that every real day is simulated by 24 seconds. The noise at House #1 is to be measured every 4 hours. The noise at House #2 is to be measured every 6 hours. The noise at House #3 is to be measured every 9 hours. The noise at Industrial site #4 is to be measured every 3 hours. The noise at Industrial site #5 is to be measured every 4 hours. If the 40 Hz Hum is present at any site, then blink the LED associated with that site.; meaning if the noise is present at house #3, blink LED #3 ever hour (1/2 second on, ½ second off). If the noise is present at both a house and an industrial site, then BLINK LED#6 on for ¼ second and off for ¼ second.

9 Mocking functions are (simple) software functions that behave like the real hardware. project Put this code in its own file and link into // Pretend that there are stored audio frequency files on the internet. Each file contains an array of ARRAYSIZE floats that contains the power in frequency bands 10 Hz, 20 Hz, 30 Hz up to 190 Hz. // Hz 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190 // Example pretendinternetfile[ ] = { 60, 00, 00, 60, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,... Does not show the hum(40, 80, 120) // Example pretendinternetfile[ ] = { 60, 00, 00, 60, 60, 00, 00, 00, 00, 00, 00, 00, 00, 00,... Show a 40 Hz signal, not the hum // Example pretendinternetfile[ ] = { 60, 00, 00, 60, 60, 00, 00, 00, 80, 00, 00, 00, 80, 00,... Shows true hum characteristics // Example pretendinternetfile[ ] = { 60, 00, 00, 60, 60, 00, 00, 00, 80, 00, 00, 00, 40, 00,... Shows false hum characteristics #define ARRAYSIZE 20 static float pretendinternetfile[arraysize]; #include <stdlib.h> int rand(void); // The rand function returns a pseudo random integer value in the range [0, ]. // For this function, the measure of randomness is its periodicity the number of values it is likely to generate before // repeating a pattern. The output of the pseudo random number generator has a period in the order of float * Mock_GetFrequencyMeasurementsFromSite( void) { for (int count = 1, count < ARRAYSIZE, count++) { float dummyreading = 20.0 * (rand( ) % 5); pretendinternetfile[count] = dummyreading; return pretendinternetfile; int Is40HzHumPresent(float *audiofile) { // Check the array for 40 Hz signal and its first and second overtone (80 Hz and 120 Hz) are ALL present at the same time with a strength greater than 50. // If so, return 1, otherwise return 0 The pseudo code for the Main program will look something like this except you should be using super loop syntax void main( ) { SetStuffUp( ); int humpresent = 0; quit = 0; while (quit == 0) for (site = 0; site < 6; site++) if timetomeasuresite( site) == true { GetFrequencyMeasurementsFromSite( ); unsigned int ispresent = Is40HzHumPresent( ); if ispresent == 1 { humpresent = humpresent (1 < site); // Turns on IS THERE bit using OR operator // Turn on LED #site as well else { humpresent = humpresent & ~(1 < site); // Turns off IS THERE bit using AND and NOT (twiddle) operator // Turn off LED #site as well

10 // Use logical and Bit wise AND and OR operations to activate blinking if ((humpresent % 0x38) > 0) // Industrial site noise MASK using b && ((humpresent % 007) > 0) // House site noise MASK using b StartBlinkingAction( ) else StopBlinkingAction( );

11 Example of a super loop task The task void LED1ControlTask(void) has three possible states LED1_UNKNOWN, LED1_ON and LED1_OFF. Code that information via a C++ enum statement. Task stories enum {LED1_UNKNOWN, LED1_ON. LED1_OFF; If the task is run and ends up in an unknown state issue error message If the task is run when in state LED1_OFF, turn the led on If the task is run when in state LED1_ON, turn the led off; So the task code would look something like this void LED1ControlTask(void) { static unsigned int currentstate = UNKNOWN unsigned int nextstate = UNKNOWN // What does the C++ keyword static mean switch (currentstate) { case LED1_ON: Function call to turn LED 1 off nextstate = LED1_OFF break; case LED1_OFF: Function call to turn LED 1 on nextstate = LED1_ON break; default: printf( UNKNOWN STATE IN LED1ControlTask\n ); // Can t use print statement for errors in real embedded systems why not? nextstate = UNKNOWN; break; currentstate = nextstate;

12 When I generate tasks with states, I like to make some text substitutions in the source file using C++ define statements to make the code easier to read #define BEGIN_STATE case #define END_STATE break #define ERROR_STATE default // Add this to the assignment 1 include / header file so only need to add once void LED1ControlTask(void) { static unsigned int currentstate = UNKNOWN unsigned int nextstate = UNKNOWN // What is the C++ keyword static mean switch (currentstate) { BEGIN_STATE LED1_ON: Function call to turn LED 1 off nextstate = LED1_OFF END_STATE; BEGIN_STATE: LED1_OFF: Function call to turn LED 1 on nextstate = LED1_ON END_STATE; ERROR_STATE: printf( UNLNOWN STATE IN LED1ControlTask\n ); // Can t use print statement for errors in real embedded systems why not? nextstate = UNKNOWN; END_STATE; currentstate = nextstate; With the task written, we can add it to the super loop code. There are many ways to do this Key rule when writing tasks no task is allowed to wait to do something (wait for 1 second then turn light off). That would cause the other tasks to block To avoid blocking other tasks, I would call the LED1 task like this #define ULL unsigned long long int // Place in include / header file ULL currecntcyclecount =.. ULL nextled1executiontime = currecntcyclecount + ONE_SECOND while (1) { currecntcyclecount =.. if (nextled1executiontime < currentcyclecount) { nextled1executiontime = nextled1executiontime + ONE_SECOND // Why add to nextled1executiontime and not to currentcyclecount? LED1Task( ); etc.

Table of Contents. ENCM511 Assignment 1 Marking Scheme Want to drive the real car on the A301 track later in the term. It can be arranged, but

Table of Contents. ENCM511 Assignment 1 Marking Scheme Want to drive the real car on the A301 track later in the term. It can be arranged, but Assignment 1 V3 Final 1 st October 2013 P age 1 Assignment 1 V3 Final 1 st October 2013 P age 2 YOUR NAME LAB. Section Table of Contents ENCM511 Assignment 1 V2 We shall drive a virtual car during this

More information

Getting the O in I/O to work on a typical microcontroller

Getting the O in I/O to work on a typical microcontroller Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller used in the Familiarization Lab Agenda Processors

More information

Getting the O in I/O to work on a typical microcontroller

Getting the O in I/O to work on a typical microcontroller Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller used in the Familiarization Lab Agenda Processors

More information

Slide Set 1. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 1. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 1 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2016 ENCM 339 Fall 2016 Slide Set 1 slide 2/43

More information

Building a COFFEE POT simulation on CCESS for Blackfin BF533

Building a COFFEE POT simulation on CCESS for Blackfin BF533 Building a COFFEE POT simulation on CCESS 2.6.0 for Blackfin BF533 Last lecture covered some detailed ideas Let step back and do something simpler to get an introduction of ideas needed for Lab0 and Assignment

More information

Laboratory 1 Manual V1.2 1 st September 2007 Developing a Blackfin GPIO interface using an automated embedded testing environment

Laboratory 1 Manual V1.2 1 st September 2007 Developing a Blackfin GPIO interface using an automated embedded testing environment Laboratory 1 Manual V1.2 1 st September 2007 Developing a Blackfin GPIO interface using an automated embedded testing environment These pages are cut-and-paste from the Lab. 1 web-pages. I have not spent

More information

Introduction to Test Driven Development (To be used throughout the course)

Introduction to Test Driven Development (To be used throughout the course) Introduction to Test Driven Development (To be used throughout the course) Building tests and code for a software radio Concepts Stages in a conventional radio Stages in a software radio Goals for the

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

Matlab? Chapter 3-4 Matlab and IPT Basics. Working Environment. Matlab Demo. Array. Data Type. MATLAB Desktop:

Matlab? Chapter 3-4 Matlab and IPT Basics. Working Environment. Matlab Demo. Array. Data Type. MATLAB Desktop: Matlab? Lecture Slides ME 4060 Machine Vision and Vision-based Control Chapter 3-4 Matlab and IPT Basics By Dr. Debao Zhou 1 MATric LABoratory data analysis, prototype and visualization Matrix operation

More information

Lab. 2 Overview. Echo Switches to LED to test LEDs and Switches. How would you handle a more complex set of embedded tests

Lab. 2 Overview. Echo Switches to LED to test LEDs and Switches. How would you handle a more complex set of embedded tests Lab. 2 Overview Echo Switches to LED to test LEDs and Switches volatile unsigned char GPIOvalue; // In embedded systems ALL Global variable must be // made volatile (change-able) to reflect they are //

More information

ENCM 335 Fall 2018 Lab 2 for the Week of September 24

ENCM 335 Fall 2018 Lab 2 for the Week of September 24 page 1 of 8 ENCM 335 Fall 2018 Lab 2 for the Week of September 24 Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2018 Lab instructions and other documents

More information

In addition to name. Each variable in C program is characterized by its Type Scope Storage Class. Type Have already discussed

In addition to name. Each variable in C program is characterized by its Type Scope Storage Class. Type Have already discussed Variables, Storage Class, Scope, Multiple File Multiple Module Projects Overview Will examine how variables characterized Will introduce and study variable s storage class Will examine a variable s visibility

More information

Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Data Types Basic Types Enumerated types The type void Derived types

More information

Slide Set 3. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng

Slide Set 3. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng Slide Set 3 for ENCM 339 Fall 2017 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2017 ENCM 339 Fall 2017 Section 01

More information

COSC 2P91. Introduction Part Deux. Week 1b. Brock University. Brock University (Week 1b) Introduction Part Deux 1 / 14

COSC 2P91. Introduction Part Deux. Week 1b. Brock University. Brock University (Week 1b) Introduction Part Deux 1 / 14 COSC 2P91 Introduction Part Deux Week 1b Brock University Brock University (Week 1b) Introduction Part Deux 1 / 14 Source Files Like most other compiled languages, we ll be dealing with a few different

More information

Slide Set 2. for ENCM 335 in Fall Steve Norman, PhD, PEng

Slide Set 2. for ENCM 335 in Fall Steve Norman, PhD, PEng Slide Set 2 for ENCM 335 in Fall 2018 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2018 ENCM 335 Fall 2018 Slide Set 2 slide

More information

(Refer Slide Time 01:41 min)

(Refer Slide Time 01:41 min) Programming and Data Structure Dr. P.P.Chakraborty Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture # 03 C Programming - II We shall continue our study of

More information

Here's how you declare a function that returns a pointer to a character:

Here's how you declare a function that returns a pointer to a character: 23 of 40 3/28/2013 10:35 PM Violets are blue Roses are red C has been around, But it is new to you! ANALYSIS: Lines 32 and 33 in main() prompt the user for the desired sort order. The value entered is

More information

To become familiar with array manipulation, searching, and sorting.

To become familiar with array manipulation, searching, and sorting. ELECTRICAL AND COMPUTER ENGINEERING 06-88-211: COMPUTER AIDED ANALYSIS LABORATORY EXPERIMENT #2: INTRODUCTION TO ARRAYS SID: OBJECTIVE: SECTIONS: Total Mark (out of 20): To become familiar with array manipulation,

More information

Operator overloading

Operator overloading 1 Introduction 2 The copy constructor 3 Operator Overloading 4 Eg 1: Adding two vectors 5 The -> operator 6 The this pointer 7 Overloading = 8 Unary operators 9 Overloading for the matrix class 10 The

More information

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?

More information

Presented By : Gaurav Juneja

Presented By : Gaurav Juneja Presented By : Gaurav Juneja Introduction C is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs of UNIX are written

More information

QUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:

QUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below: QUIZ 1. Explain the meaning of the angle brackets in the declaration of v below: This is a template, used for generic programming! QUIZ 2. Why is the vector class called a container? 3. Explain how the

More information

Slide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 5 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2016 ENCM 339 Fall 2016 Slide Set 5 slide 2/32

More information

Compiling with Multiple Files The Importance of Debugging CS 16: Solving Problems with Computers I Lecture #7

Compiling with Multiple Files The Importance of Debugging CS 16: Solving Problems with Computers I Lecture #7 Compiling with Multiple Files The Importance of Debugging CS 16: Solving Problems with Computers I Lecture #7 Ziad Matni Dept. of Computer Science, UCSB Programming in Multiple Files The Magic of Makefiles!

More information

Comp 11 Lectures. Mike Shah. June 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures June 26, / 57

Comp 11 Lectures. Mike Shah. June 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures June 26, / 57 Comp 11 Lectures Mike Shah Tufts University June 26, 2017 Mike Shah (Tufts University) Comp 11 Lectures June 26, 2017 1 / 57 Please do not distribute or host these slides without prior permission. Mike

More information

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you

More information

Generating Rectify( ) Test driven development approach to TigerSHARC

Generating Rectify( ) Test driven development approach to TigerSHARC Generating Rectify( ) Test driven development approach to TigerSHARC assembly code production Assembly code examples Part 1 of 3 Concepts Concepts of C++ stubs Forcing the test to fail test of test Generating

More information

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.

More information

Computer Programming & Problem Solving ( CPPS ) Turbo C Programming For The PC (Revised Edition ) By Robert Lafore

Computer Programming & Problem Solving ( CPPS ) Turbo C Programming For The PC (Revised Edition ) By Robert Lafore Sir Syed University of Engineering and Technology. Computer ming & Problem Solving ( CPPS ) Functions Chapter No 1 Compiled By: Sir Syed University of Engineering & Technology Computer Engineering Department

More information

Automated Testing Environment

Automated Testing Environment Automated Testing Environment Concepts required for testing embedded systems adopted in this course (quizzes, assignments and laboratories) 1 To be tackled today Why test, and what kinds of tests are there?

More information

CS 220: Introduction to Parallel Computing. Arrays. Lecture 4

CS 220: Introduction to Parallel Computing. Arrays. Lecture 4 CS 220: Introduction to Parallel Computing Arrays Lecture 4 Note: Windows I updated the VM image on the website It now includes: Sublime text Gitkraken (a nice git GUI) And the git command line tools 1/30/18

More information

The C Programming Language Guide for the Robot Course work Module

The C Programming Language Guide for the Robot Course work Module The C Programming Language Guide for the Robot Course work Module Eric Peasley 2018 v6.4 1 2 Table of Contents Variables...5 Assignments...6 Entering Numbers...6 Operators...7 Arithmetic Operators...7

More information

Slide Set 3. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 3. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 3 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2016 ENCM 339 Fall 2016 Slide Set 3 slide 2/46

More information

Slide Set 6. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng

Slide Set 6. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng Slide Set 6 for ENCM 339 Fall 2017 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2017 ENCM 339 Fall 2017 Section 01 Slide

More information

CpSc 1111 Lab 4 Formatting and Flow Control

CpSc 1111 Lab 4 Formatting and Flow Control CpSc 1111 Lab 4 Formatting and Flow Control Overview By the end of the lab, you will be able to: use fscanf() to accept a character input from the user and print out the ASCII decimal, octal, and hexadecimal

More information

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

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab By the end of Class Pseudo-code for Lab 1-2 due as part of prelab Homework #5 on website due before next class Outline Introduce Lab 1-2 Counting Timers on C8051 Interrupts Laboratory Worksheet #05 Copy

More information

Robotics and Electronics Unit 5

Robotics and Electronics Unit 5 Robotics and Electronics Unit 5 Objectives. Students will work with mechanical push buttons understand the shortcomings of the delay function and how to use the millis function. In this unit we will use

More information

the gamedesigninitiative at cornell university Lecture 7 C++ Overview

the gamedesigninitiative at cornell university Lecture 7 C++ Overview Lecture 7 Lecture 7 So You Think You Know C++ Most of you are experienced Java programmers Both in 2110 and several upper-level courses If you saw C++, was likely in a systems course Java was based on

More information

ECE2049 E17 Lecture 2: Data Representations & C Programming Basics

ECE2049 E17 Lecture 2: Data Representations & C Programming Basics ECE2049 E17 Lecture 2: Data Representations & C Programming Basics Administrivia Lab 0 after class today! o Get your MSP430 board! Install instructions for CCS are on course website under Resources o You

More information

Annotation Annotation or block comments Provide high-level description and documentation of section of code More detail than simple comments

Annotation Annotation or block comments Provide high-level description and documentation of section of code More detail than simple comments Variables, Data Types, and More Introduction In this lesson will introduce and study C annotation and comments C variables Identifiers C data types First thoughts on good coding style Declarations vs.

More information

ENCM 369 Winter 2019 Lab 6 for the Week of February 25

ENCM 369 Winter 2019 Lab 6 for the Week of February 25 page of ENCM 369 Winter 29 Lab 6 for the Week of February 25 Steve Norman Department of Electrical & Computer Engineering University of Calgary February 29 Lab instructions and other documents for ENCM

More information

Two s Complement Review. Two s Complement Review. Agenda. Agenda 6/21/2011

Two s Complement Review. Two s Complement Review. Agenda. Agenda 6/21/2011 Two s Complement Review CS 61C: Great Ideas in Computer Architecture (Machine Structures) Introduction to C (Part I) Instructor: Michael Greenbaum http://inst.eecs.berkeley.edu/~cs61c/su11 Suppose we had

More information

Introduction to C Programming. What is a C program?

Introduction to C Programming. What is a C program? Introduction to C Programming Goals of this section Write a simple C program - Steps Write or develop code Compile Link Execute Add comments to C code 85-132 Introduction to C-Programming 2-1 What is a

More information

CS 104 (Spring 2014) Final Exam 05/09/2014

CS 104 (Spring 2014) Final Exam 05/09/2014 CS 104 (Spring 2014) Final Exam 05/09/2014 G o o d L u c k Your Name, USC username, and Student ID: This exam has 8 pages and 8 questions. If yours does not, please contact us immediately. Please read

More information

C++ Support Classes (Data and Variables)

C++ Support Classes (Data and Variables) C++ Support Classes (Data and Variables) School of Mathematics 2018 Today s lecture Topics: Computers and Programs; Syntax and Structure of a Program; Data and Variables; Aims: Understand the idea of programming

More information

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage: Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;

More information

0x0d2C May your signals all trap May your references be bounded All memory aligned Floats to ints round. remember...

0x0d2C May your signals all trap May your references be bounded All memory aligned Floats to ints round. remember... Types Page 1 "ode to C" Monday, September 18, 2006 4:09 PM 0x0d2C ------ May your signals all trap May your references be bounded All memory aligned Floats to ints round remember... Non -zero is true ++

More information

QUIZ. What is wrong with this code that uses default arguments?

QUIZ. What is wrong with this code that uses default arguments? QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code

More information

Using the KD30 Debugger

Using the KD30 Debugger ELEC3730 Embedded Systems Tutorial 3 Using the KD30 Debugger 1 Introduction Overview The KD30 debugger is a powerful software tool that can greatly reduce the time it takes to develop complex programs

More information

Singly linked lists in C.

Singly linked lists in C. Singly linked lists in C http://www.cprogramming.com/tutorial/c/lesson15.html By Alex Allain Linked lists are a way to store data with structures so that the programmer can automatically create a new place

More information

ENCM 369 Winter 2017 Lab 3 for the Week of January 30

ENCM 369 Winter 2017 Lab 3 for the Week of January 30 page 1 of 11 ENCM 369 Winter 2017 Lab 3 for the Week of January 30 Steve Norman Department of Electrical & Computer Engineering University of Calgary January 2017 Lab instructions and other documents for

More information

Test driven development Example

Test driven development Example Test driven development Example Developing a moving average filter that can be tested using the EUNIT plug in REVIEW Using the E UNIT testing Framework Activate CCES and select your workspace (H:/ENCM511

More information

Lab 1 Implementing a Simon Says Game

Lab 1 Implementing a Simon Says Game ECE2049 Embedded Computing in Engineering Design Lab 1 Implementing a Simon Says Game In the late 1970s and early 1980s, one of the first and most popular electronic games was Simon by Milton Bradley.

More information

Before Class Install SDCC Instructions in Installing_SiLabs-SDCC- Drivers document. Solutions to Number Systems Worksheet. Announcements.

Before Class Install SDCC Instructions in Installing_SiLabs-SDCC- Drivers document. Solutions to Number Systems Worksheet. Announcements. August 15, 2016 Before Class Install SDCC Instructions in Installing_SiLabs-SDCC- Drivers document Install SiLabs Instructions in Installing_SiLabs-SDCC- Drivers document Install SecureCRT On LMS, also

More information

Quiz 0 Answer Key. Answers other than the below may be possible. Multiple Choice. 0. a 1. a 2. b 3. c 4. b 5. d. True or False.

Quiz 0 Answer Key. Answers other than the below may be possible. Multiple Choice. 0. a 1. a 2. b 3. c 4. b 5. d. True or False. Quiz 0 Answer Key Answers other than the below may be possible. Multiple Choice. 0. a 1. a 2. b 3. c 4. b 5. d True or False. 6. T or F 7. T 8. F 9. T 10. T or F Itching for Week 0? 11. 00011001 + 00011001

More information

Project 1 Balanced binary

Project 1 Balanced binary CMSC262 DS/Alg Applied Blaheta Project 1 Balanced binary Due: 7 September 2017 You saw basic binary search trees in 162, and may remember that their weakness is that in the worst case they behave like

More information

Introduction to Computing Lecture 01: Introduction to C

Introduction to Computing Lecture 01: Introduction to C Introduction to Computing Lecture 01: Introduction to C Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical&Electronics Engineering ozbek.nukhet@gmail.com Topics Introduction to C language

More information

All these things are discussed today QUICK REVIEW QUIZ 1 / Midterm

All these things are discussed today QUICK REVIEW QUIZ 1 / Midterm All these things are discussed today QUICK REVIEW QUIZ 1 / Midterm VIP (Very Important Points) from Micro controller v Microprocessor lecture Microcontroller MUST be able to talk to many devices and receive

More information

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

More information

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm Instructions: Show your work. Correct answers with no work will not receive full credit. Whether

More information

Lecture 19 CSE August You taught me Language, and my profit on t is I know how to curse. William Shakspere, The Tempest, I, ii.

Lecture 19 CSE August You taught me Language, and my profit on t is I know how to curse. William Shakspere, The Tempest, I, ii. Lecture 19 CSE 110 5 August 1992 You taught me Language, and my profit on t is I know how to curse. William Shakspere, The Tempest, I, ii. 1 Left-Over Language Features Today was the day we saw the last

More information

Compiling and Running a C Program in Unix

Compiling and Running a C Program in Unix CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 95 ] Compiling and Running a C Program in Unix Simple scenario in which your program is in a single file: Suppose you want to name

More information

CS16 Exam #1 7/17/ Minutes 100 Points total

CS16 Exam #1 7/17/ Minutes 100 Points total CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding

More information

Lab 1 Implementing a Simon Says Game

Lab 1 Implementing a Simon Says Game ECE2049 Embedded Computing in Engineering Design Lab 1 Implementing a Simon Says Game In the late 1970s and early 1980s, one of the first and most popular electronic games was Simon by Milton Bradley.

More information

Conditionals: More Fun with If-Then and Logic Operators

Conditionals: More Fun with If-Then and Logic Operators Conditionals: More Fun with If-Then and Logic Operators Goals Great job so far! There are a lot of things you already know how to do! In this tutorial and in the following ones you will get a chance to

More information

How to approach a computational problem

How to approach a computational problem How to approach a computational problem A lot of people find computer programming difficult, especially when they first get started with it. Sometimes the problems are problems specifically related to

More information

CS 137 Part 2. Loops, Functions, Recursion, Arrays. September 22nd, 2017

CS 137 Part 2. Loops, Functions, Recursion, Arrays. September 22nd, 2017 CS 137 Part 2 Loops, Functions, Recursion, Arrays September 22nd, 2017 Loops We will finish this week with looping statements We already discussed one such structure, namely while loops. while (expr) statement

More information

Mobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09

Mobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09 Mobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09 Hello, today we will create another application called a math quiz. This

More information

GCSE Computer Science Component 02

GCSE Computer Science Component 02 GCSE Computer Science Component 02 Revision Computational Thinking ABSTRACTION Making a problem simpler by removing unnecessary details. This is important when coding as it: Makes it easier to code! Means

More information

Topic 6: A Quick Intro To C

Topic 6: A Quick Intro To C Topic 6: A Quick Intro To C Assumption: All of you know Java. Much of C syntax is the same. Also: Many of you have used C or C++. Goal for this topic: you can write & run a simple C program basic functions

More information

CS3157: Advanced Programming. Outline

CS3157: Advanced Programming. Outline CS3157: Advanced Programming Lecture #8 Feb 27 Shlomo Hershkop shlomo@cs.columbia.edu 1 Outline More c Preprocessor Bitwise operations Character handling Math/random Review for midterm Reading: k&r ch

More information

C Functions. 5.2 Program Modules in C

C Functions. 5.2 Program Modules in C 1 5 C Functions 5.2 Program Modules in C 2 Functions Modules in C Programs combine user-defined functions with library functions - C standard library has a wide variety of functions Function calls Invoking

More information

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation CS113: Lecture 3 Topics: Variables Data types Arithmetic and Bitwise Operators Order of Evaluation 1 Variables Names of variables: Composed of letters, digits, and the underscore ( ) character. (NO spaces;

More information

Computer Programming: Skills & Concepts (CP) Variables and ints

Computer Programming: Skills & Concepts (CP) Variables and ints CP Lect 3 slide 1 25 September 2017 Computer Programming: Skills & Concepts (CP) Variables and ints C. Alexandru 25 September 2017 CP Lect 3 slide 2 25 September 2017 Week 1 Lectures Structure of the CP

More information

University of Calgary Department of Electrical and Computer Engineering ENCM 335 Instructor: Steve Norman

University of Calgary Department of Electrical and Computer Engineering ENCM 335 Instructor: Steve Norman page 1 of 6 University of Calgary Department of Electrical and Computer Engineering ENCM 335 Instructor: Steve Norman Fall 2018 MIDTERM TEST Thursday, November 1 6:30pm to 8:30pm Please do not write your

More information

Lecture 04 FUNCTIONS AND ARRAYS

Lecture 04 FUNCTIONS AND ARRAYS Lecture 04 FUNCTIONS AND ARRAYS 1 Motivations Divide hug tasks to blocks: divide programs up into sets of cooperating functions. Define new functions with function calls and parameter passing. Use functions

More information

C-Programming. CSC209: Software Tools and Systems Programming. Paul Vrbik. University of Toronto Mississauga

C-Programming. CSC209: Software Tools and Systems Programming. Paul Vrbik. University of Toronto Mississauga C-Programming CSC209: Software Tools and Systems Programming Paul Vrbik University of Toronto Mississauga https://mcs.utm.utoronto.ca/~209/ Adapted from Dan Zingaro s 2015 slides. Week 2.0 1 / 19 What

More information

Chapter 8: Intraprogram Communication. Lecture 8 1

Chapter 8: Intraprogram Communication. Lecture 8 1 Chapter 8: Intraprogram Communication Lecture 8 1 Topics Storage Types Global and Local Variables Modules and External Variables Typedefs: Renaming Types Review: Functions Pointers to Functions Lecture

More information

The University of Calgary. ENCM 339 Programming Fundamentals Fall 2016

The University of Calgary. ENCM 339 Programming Fundamentals Fall 2016 The University of Calgary ENCM 339 Programming Fundamentals Fall 2016 Instructors: S. Norman, and M. Moussavi Wednesday, November 2 7:00 to 9:00 PM The First Letter of your Last Name:! Please Print your

More information

BLM2031 Structured Programming. Zeyneb KURT

BLM2031 Structured Programming. Zeyneb KURT BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help

More information

Functions in C C Programming and Software Tools

Functions in C C Programming and Software Tools Functions in C C Programming and Software Tools N.C. State Department of Computer Science Functions in C Functions are also called subroutines or procedures One part of a program calls (or invokes the

More information

CMPE-013/L. Introduction to C Programming

CMPE-013/L. Introduction to C Programming CMPE-013/L Introduction to C Programming Bryant Wenborg Mairs Spring 2014 What we will cover in 13/L Embedded C on a microcontroller Specific issues with microcontrollers Peripheral usage Reading documentation

More information

(Refer Slide Time: 01.26)

(Refer Slide Time: 01.26) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture # 22 Why Sorting? Today we are going to be looking at sorting.

More information

Discussion 1H Notes (Week 2, 4/8) TA: Brian Choi Section Webpage:

Discussion 1H Notes (Week 2, 4/8) TA: Brian Choi Section Webpage: Discussion 1H Notes (Week 2, 4/8) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 Variables You have to instruct your computer every little thing it needs to do even

More information

Kurt Schmidt. October 30, 2018

Kurt Schmidt. October 30, 2018 to Structs Dept. of Computer Science, Drexel University October 30, 2018 Array Objectives to Structs Intended audience: Student who has working knowledge of Python To gain some experience with a statically-typed

More information

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information Laboratory 2: Programming Basics and Variables Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information 3. Comment: a. name your program with extension.c b. use o option to specify

More information

CS201 Some Important Definitions

CS201 Some Important Definitions CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data

More information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz II There are 5 questions in this quiz. There are 9 pages in this quiz

More information

Functions. Lecture 6 COP 3014 Spring February 11, 2018

Functions. Lecture 6 COP 3014 Spring February 11, 2018 Functions Lecture 6 COP 3014 Spring 2018 February 11, 2018 Functions A function is a reusable portion of a program, sometimes called a procedure or subroutine. Like a mini-program (or subprogram) in its

More information

Lecture Transcript While and Do While Statements in C++

Lecture Transcript While and Do While Statements in C++ Lecture Transcript While and Do While Statements in C++ Hello and welcome back. In this lecture we are going to look at the while and do...while iteration statements in C++. Here is a quick recap of some

More information

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3 Programming - 1 Computer Science Department 011COMP-3 لغة البرمجة 1 011 عال- 3 لطالب كلية الحاسب اآللي ونظم المعلومات 1 1.1 Machine Language A computer programming language which has binary instructions

More information

ENCM 369 Winter 2015 Lab 6 for the Week of March 2

ENCM 369 Winter 2015 Lab 6 for the Week of March 2 page of 2 ENCM 369 Winter 25 Lab 6 for the Week of March 2 Steve Norman Department of Electrical & Computer Engineering University of Calgary February 25 Lab instructions and other documents for ENCM 369

More information

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***

More information

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program Syntax What the Compiler needs to understand your program 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line Possibly replacing it with other

More information

Slide Set 4. for ENCM 335 in Fall Steve Norman, PhD, PEng

Slide Set 4. for ENCM 335 in Fall Steve Norman, PhD, PEng Slide Set 4 for ENCM 335 in Fall 2018 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2018 ENCM 335 Fall 2018 Slide Set 4 slide

More information

Part 1. Summary of For Loops and While Loops

Part 1. Summary of For Loops and While Loops NAME EET 2259 Lab 5 Loops OBJECTIVES -Understand when to use a For Loop and when to use a While Loop. -Write LabVIEW programs using each kind of loop. -Write LabVIEW programs with one loop inside another.

More information

Topic 6: A Quick Intro To C. Reading. "goto Considered Harmful" History

Topic 6: A Quick Intro To C. Reading. goto Considered Harmful History Topic 6: A Quick Intro To C Reading Assumption: All of you know basic Java. Much of C syntax is the same. Also: Some of you have used C or C++. Goal for this topic: you can write & run a simple C program

More information

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace C++ Style Guide 1.0 General The purpose of the style guide is not to restrict your programming, but rather to establish a consistent format for your programs. This will help you debug and maintain your

More information