C for Electronic Engineering

Similar documents
Contents. Preface. Introduction. Introduction to C Programming

JAVASCRIPT FOR PROGRAMMERS

C Programming for Electronic Engineers

PROGRAMMING AND CUSTOMIZING

Computers Programming Course 6. Iulian Năstac

ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV

Practical C++ Programming


M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS. Using Assembly and С

Computer Programming C++ (wg) CCOs

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23.

Using MATLAB, SIMULINK and Control System Toolbox

The Waite Group's. New. Primer Plus. Second Edition. Mitchell Waite and Stephen Prata SAMS

Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR

Programming in Python 3

GARDEN CITY UNIVERSITY. Bachelor of Computer Applications SEMESTER- I. Course: CONCEPTS OF PROGRAMMING USING C LANGUAGE CODE: 05ABCAR17111 CREDITS: 04

Reg. No. : Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, JANUARY First Semester GE 6151 COMPUTER PROGRAMMING

Continued from previous lecture

C-LANGUAGE CURRICULAM

Advanced C Programming Topics

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below:

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

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE

Lecture 02 C FUNDAMENTALS

SU 2017 May 11/16 LAB 2: Character and integer literals, number systems, character arrays manipulation, relational operator

LATEX. Leslie Lamport. Digital Equipment Corporation. Illustrations by Duane Bibby. v ADDISON-WESLEY

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

Computers Programming Course 5. Iulian Năstac

Software Development & Education Center C Programming

Introduction to C Language

PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur

Workbook for C++ THIRD EDITION. Yedidyah Langsam, Ph.D. Brooklyn College of the City University of New York. Custom Publishing

CS PROGRAMMING & ATA STRUCTURES I. UNIT I Part - A

C & Data Structures syllabus

M1-R4: Programing and Problem Solving using C (JULY 2018)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1

Welcome to Teach Yourself Acknowledgments Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p.

A Document Preparation System. User's Guide and Reference Manual. Leslie Lamport

Practical C Programming. Steve Oualline

B.Sc. Final B.SC. PART-III PAPER I COMPUTER ORGANIZATION II

Code No: R Set No. 1

Course Outline Introduction to C-Programming

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS


Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

The Unified Modeling Language User Guide

SOME ASSEMBLY REQUIRED

Reserved Words and Identifiers

(i) Describe in detail about the classification of computers with their features and limitations(10)

Goals of C "" The Goals of C (cont.) "" Goals of this Lecture"" The Design of C: A Rational Reconstruction"

NOTIFICATION (Advt No. 1/2018) Syllabus (Paper III)

ony Gaddis Haywood Community College STARTING OUT WITH PEARSON Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto

SAURASHTRA UNIVERSITY

MECHATRONICS. William Bolton. Sixth Edition ELECTRONIC CONTROL SYSTEMS ENGINEERING IN MECHANICAL AND ELECTRICAL PEARSON

CPLD Software Tutorial FOR ALTERA MAX+PLUS II

Contents. A Review of C language. Visual C Visual C++ 6.0

Programming Fundamentals - A Modular Structured Approach using C++ By: Kenneth Leroy Busbee

Visual C# Tony Gaddis. Haywood Community College STARTING OUT WITH. Piyali Sengupta. Third Edition. Global Edition contributions by.

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered ) FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING

C Program. Output. Hi everyone. #include <stdio.h> main () { printf ( Hi everyone\n ); }

The Design of C: A Rational Reconstruction: Part 2

Logic and its Applications

Contents. 1 Introduction to Computers, the Internet and the World Wide Web 1. 2 Introduction to C Programming 26

THE FUNDAMENTAL DATA TYPES

Multiple Choice Questions ( 1 mark)

3. Types of Algorithmic and Program Instructions

Arduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface.

PYTHON. p ykos vtawynivis. Second eciitiovl. CO Ve, WESLEY J. CHUN

Princeton University Computer Science 217: Introduction to Programming Systems The Design of C

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ENGINEERING PROBLEM SOLVING WITH C++

Fundamentals of Programming. Lecture 11: C Characters and Strings

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

Application Programming

Prelude to Programming

C Programming Multiple. Choice

Hardware description language (HDL)

2/5/2018. Expressions are Used to Perform Calculations. ECE 220: Computer Systems & Programming. Our Class Focuses on Four Types of Operator in C

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

CLASSIC DATA STRUCTURES IN JAVA

MariaDB Crash Course. A Addison-Wesley. Ben Forta. Upper Saddle River, NJ Boston. Indianapolis. Singapore Mexico City. Cape Town Sydney.

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

File Handling in C. EECS 2031 Fall October 27, 2014

CT 229 Java Syntax Continued

BSM540 Basics of C Language

Unit 4. Input/Output Functions

Digital System Design with SystemVerilog

Introduction to C++ with content from

Model Viva Questions for Programming in C lab

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

B.Sc II Year Computer Science (Optional)

Computer Organization & Systems Exam I Example Questions

V.S.B ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY I IT-II Semester. Sl.No Subject Name Page No. 1 Programming & Data Structures-I 2

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

Name :. Roll No. :... Invigilator s Signature : INTRODUCTION TO PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

sends the formatted data to the standard output stream (stdout) int printf ( format_string, argument_1, argument_2,... ) ;

Transcription:

C for Electronic Engineering with applied software engineering William Buchanan Prentice Hall London New York Toronto Sydney Tokyo Singapore Madrid Mexico City Munich

CONTENTS PREFACE 1 INTRODUCTION 1.1 Hardware, software and firmware 1.2 History of C 1.3 Basic computer architecture 1.4 Compiling, linking and producing an executable program 1.5 Pre-processor 1.6 Structure 1.7 Numbers and representations 1.7.1 Negative numbers 1.7.2 Hexadecimal and octal numbers 1.8 Character constants 1.9 Data types 1.10 Declaration of variables 1.11 C operators 1.11.1 Arithmetic 1.11.2 Relationship 1.11.3 Logical (TRUE or FALSE) 1.11.4 Bitwise 1.12 Precedence

viii Cfor Electronic Engineering 1.13 Data type conversion 1.14 Keywords 1.15 Jargon 1.16 Tutorial 2 INPUT/OUTPUT 2.1 Standard output (printf (), puts () and putchar ()) 2.1.1 Special control characters 2.1.2 Conversion control characters 2.1.3 Examples 2.2 Standard input (scanf (), gets () and getchar ()) 2.2.1 Examples 2.3 Tutorial 3 SELECTION STATEMENTS 3.1 if..else statements 3.1.1 Examples 3.2 switch statement 3.2.1 Examples 3.3 Tutorial 4 REPETITIVE STATEMENTS 4.1 for 4.1.1 Examples 4.2 while () 4.3 do..while () 4.4 break 4.5 continue 4.6 Examples 4.6.1 Boolean equation 4.6.2 CR active filter 4.7 Tutorial 5 FUNCTIONS

5.1 Parameter passing 5.2 Return value 5.3 Function type 5.4 Using the pre-processor to define function macros 5.5 Examples 5.5.1 Combinational logic 5.5.2 Impedance of a series RL circuit 5.5.3 AC response of a series RC circuit 5.5.4 Harmonics of a repetitive pulse waveform 5.5.5 Classification of radio waves 5.5.6 Impedance of a transmission line 5.6 Tutorial 6 POINTERS 6.1 Pointers with functions 6.2 Examples 6.2.1 Quadratic equations 6.2.2 Equivalent parallel resistance 6.2.3 Impedance of an RL circuit 6.2.4 Memory viewer 6.2.5 Accessing PC video text memory 6.3 Tutorial 7 ARRAYS 7.1 Pointers and arrays 7.2 Passing arrays to functions 7.3 Array initialization 7.4 Multidimensional arrays 7.5 Dynamic allocation 7.6 Pointer arithmetic 7.7 Arrray of pointers 7.8 Examples 7.8.1 Boolean circuit 7.8.2 Impedance of an RL circuit 7.8.3 DC circuit analysis 7.8.4 Logic simulation

x Cfor Electronic Engineering 7.9 Tutorial 8 STRINGS 8.1 String input 8.2 String assignment 8.3 Standard string functions 8.4 Impedance of a parallel RC circuit 8.5 Circuit selection 8.6 Setting up an array of strings 8.7 Tutorial 9 STRUCTURES 9.1 Array of structures 9.2 Allocating structures dynamically 9.3 Bit fields 9.4 Time structure 9.5 Examples 9.5.1 Traffic light sequence 9.5.2 Input impedance of an RLC circuit 9.5.3 74-series ICs 9.6 Tutorial 10 FILE INPUT/OUTPUT 10.1 Opening a file (f open ()) 10.2 Closing a file (f close ()) 10.3 Printing text to a file (f printf ()) 10.4 Reading text from a file (f scanf ()) 10.5 Finding the end of a file (f eof ()) 10.6 Getting a string of text from a file (f gets ()) 10.7 Putting a string of text to a file (f puts ())

Contents xi 10.8 Putting a character to a file (f puto ()) 260 10.9 Getting a character from a file (f getc ()) 260 10.10 Binary files 261 10.10.1 Reading binary data from a file (f read ()) 261 10.10.2 Writing binary data to a file (fwrite ()) 261 10.11 Examples 262 10.11.1 Boolean equation 262 10.11.2 Averages program 264 10.11.3 Binary read/write 266 10.12 Tutorial 268 11 SYSTEMS PROGRAMMING 273 11.1 System calls 273 11.2 Passing arguments 276 11.3 Examples 277 11.4 Tutorial 280 12 PROJECTS 283 12.1 Resonant frequency of a series RLC circuit 283 12.2 Current flow in a diode 286 12.3 Boolean circuit 289 12.4 Decimal to binary converter 291 12.5 Resistor colour code program 293 12.6 Tutorial 296 13 APPLIED SOFTWARE ENGINEERING 307 13.1 Software development 307 13.2 RLC circuit program 308 13.2.1 Requirement analysis and specification 308 13.2.2 Requirement analysis 309 13.2.3 Requirements specification 310 13.2.4 Design 315 13.2.5 Module specifications 316 13.2.6 Implementation 318 13.2.7 Version control 323

xii Cfor Electronic Engineering 13.2.8 System testing 13.2.9 Installation 13.3 Linear feedback shift register 13.3.1 Requirements analysis 13.3.2 Requirements specification 13.3.3 Design 13.3.4 Module specifications 13.3.5 Coding 13.3.6 System testing 13.3.7 Installation 323 327 328 328 329 330 331 332 335 336 13.4 Tutorial 337 14 INTRODUCTION TO PC GRAPHICS USING TURBO/BORLAND C 341 14.1 Basic graphics routines 14.1.1 Closing graphics 14.1.2 Initializing graphics 14.1.3 Drawing a pixel 14.1.4 Drawing a line 14.1.5 Drawing a rectangle 14.1.6 Displaying text 14.1.7 Drawing a circle 14.1.8 Bit-mapped graphics 14.2 Tutorial 346 346 346 347 349 349 351 352 353 356 APPENDIX Al Structure charts A2 Header flies and associated functions A2.1 Classification routines A2.2 Conversion routines A2.3 Input/ Output routines A2.4 String manipulation routines A2.5 Math routines A2.6 Time and Date routines A2.7 Other standard routines A3 Things that can go wrong A3.1 Typical compiler errors A3.2 Typical compiler warnings A3.3 Typical run-time errors ICO 360 361 363 364 368 369 372 373 373 373 377 381 INDEX 385