Presentation By :- Nikhil R. Anande (130950111005) Electronic & Communication Engineering. 3 nd Year / 5 th Semester FACULTY GUIDE : RAHIUL PATEL SIR MICROCONTROLLER.

Slides:



Advertisements
Similar presentations
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
Advertisements

CSCI 51 Introduction to Programming Dr. Joshua Stough February 10, 2009.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Homework Any Questions?. Statements / Blocks, Section 3.1 An expression becomes a statement when it is followed by a semicolon x = 0; Braces are used.
C Lecture Notes 1 Program Control (Cont...). C Lecture Notes 2 4.8The do / while Repetition Structure The do / while repetition structure –Similar to.
Programming Concepts (Part A) Ping Hsu. What is a program? WHITE CAKE RECIPE 1.Preheat oven to 350 degrees F (175 degrees C). 2.Grease and flour a 9x9.
Iteration This week we will learn how to use iteration in C++ Iteration is the repetition of a statement or block of statements in a program. C++ has three.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Where are we? Programming in Java consists of creating source code in an editor. Source code is compiled to bytecode by the Java compiler – javac The bytecode.
Lecture 3 Strings More control statements C functions.
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
C++ for Engineers and Scientists Third Edition
Section 3 - Selection and Repetition Constructs. Control Structures 1. Sequence 2. Selection 3. Repetition.
An Introduction to C Programming Geb Thomas. Learning Objectives Learn how to write and compile a C program Learn what C libraries are Understand the.
Introduction to C Language
UNIT II Decision Making And Branching Decision Making And Looping
 Decision making statements Decision making statements if statement if...else statement Nested if...else statement (if...elseif....else Statement) 
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
1 Chapter 4: Selection Structures. In this chapter, you will learn about: – Selection criteria – The if-else statement – Nested if statements – The switch.
COMPUTER PROGRAMMING. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may repeat code.
Chapter 3 Control Flow Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
1 Lecture 5: Selection Structures. Outline 2  Control Structures  Conditions  Relational Operators  Logical Operators  if statements  Two-Alternatives.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
C# Programming Fundamentals Control Flow Jim Warren, COMPSCI 280 S Enterprise Software Development.
Control Structures By Shyam Gurram. Control Structure In this chapter we have two different types of structures. Conditional Structure Iterative Control.
6/3/2016 CSI Chapter 02 1 Introduction of Flow of Control There are times when you need to vary the way your program executes based on given input.
Chapter 7 Selection Dept of Computer Engineering Khon Kaen University.
Basic Java Syntax COMP 401, Spring 2014 Lecture 2 1/14/2014.
CSC1201: Programming Language 2 Lecture 1 Level 2 Course Nouf Aljaffan (C) CSC 1201 Course at KSU1.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics Lecture 5.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Java Nuts and Bolts Variables and Data Types Operators Expressions Control Flow Statements Arrays and Strings.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
By Mr. Muhammad Pervez Akhtar
 Control Flow statements ◦ Selection statements ◦ Iteration statements ◦ Jump statements.
BOOLEAN OPERATIONS AND CONDITIONALS CHAPTER 20 1.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 How did your team meetings go? A list of three possible “adoptable” projects is linked near the bottom.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Lecturer: Nguyen Thi Hien Software Engineering Department Home page: hienngong.wordpress.com Chapter 2: Language C++
Control structures in C by Dr P.Padmanabham Professor (CSE)&Director Bharat Institute of Engineering &Technology Hyderabad Mobile
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
5 Copyright © 2004, Oracle. All rights reserved. Controlling Program Flow.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Intro. to Computer Programming Eng. Nehal A. Mohamed Spring Semester-2016.
C syntax (simplified) BNF. Program ::= [ ] Directives ::= [ ] ::= | |… ::=#include > ::=#define.
C++ for Engineers and Scientists Second Edition Chapter 4 Selection Structures.
Loops in Java.
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
Chapter 3: Understanding C# Language Fundamentals
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.
Starting JavaProgramming
IF if (condition) { Process… }
Introduction to Programming
Flow of Control October 16, 2017.
Conditional Statements
Module 2: Understanding C# Language Fundamentals
Introduction C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell.
Program Breakdown, Variables, Types, Control Flow, and Input/Output
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
C Programming Getting started Variables Basic C operators Conditionals
2. Second Step for Learning C++ Programming • Data Type • Char • Float
Fundamental Programming
An Overview of C.
C Language B. DHIVYA 17PCA140 II MCA.
CIS 136 Building Mobile Apps
Presentation transcript:

Presentation By :- Nikhil R. Anande ( ) Electronic & Communication Engineering. 3 nd Year / 5 th Semester FACULTY GUIDE : RAHIUL PATEL SIR MICROCONTROLLER AND INTERFACING ( )

 we review briefly major aspects of the C programming language. A. Structure of a C program B. Data types and operators C. Flow control in C D. C functions

 A C program typically has two main sections.  Section #include: to insert header files.  Section main(): code that runs when the program starts.  Section #define: this directive is used for defining a text substitution string.  Comments are text that the compiler ignores.  For a single-line comment, use double forward slashes: For ex: DDRA = 0 00 x ;  Always use comments to make program easy to understand.

 Comments are text that the compiler ignores.  For a single-line comment, use double forward slashes: For ex: DDRA = 0x00 ;  Always use comments to make program easy to understand.

C statements:  C statements control the program flow.  They consist of keywords, expressions and other statements  A statement ends with semicolon. for ex: DDRB = 0xFF;  C blocks:  A C block is a group of statements enclosed by braces {}.  It is typically associated with if, switch, for, do, while, or functions.

The main data types in C are  char: 8-bit integer in AVR  int: 16-bit integer in AVR  long int: 32-bit integer in AVR  The above data types can be modified by keyword The above data types can be modified by keyword ‘unsigned’  Char a;  unsigned char b;  unsigned long int c;  In C, a variable or function must be declared before it is used.

Arithmetic operators Relational operators Logical operators Logical operators Bit-wise operators

These operators are applied on logical variables or constants.

These operators are applied on individual bits of a variable or constant.

By default, C statements are executed sequentially. To change the program flow, there are six types of statements if-else statement switch statement Conditional while statement for statement Iterative

General syntax if (expression) statement_1; else statement_2;  Example Char a, b, sum; a = 4; b = -5; sm a bu = + b; if (sum < 0) printf(“sum is negative”); else if (sum > 0) printf(“sum is positive”); else printf(“sum is zero”);

General syntax: Its format is: switch (expression) case constant_1: statement_1; Break; Case constant_2: statement _ 2; Break; Case constant _ n: statement_n; break; default: statement_other; }

 General syntax:  While a condition is true, the while loop repeats a statement or block of code.  Before executing the statement the value of expression is checked.  Its is format: while (expression) { statements; }

General syntax Its is format: for (expression1; expression2; expression3) { statements; }  expression1 is run before the loop starts.  expression2 is evaluated before each iteration.  expression3 is run after each iteration.

C functions are sub-routines that can be called from the main program or other functions. program or other functions. Functions enable modular designs code reuse and hiding of Functions enable modular designs, code reuse, and hiding of complex implementation details. A C function can have a list of parameters and produce a return value.