Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS3369: Real Time Computer Control Software

Similar presentations


Presentation on theme: "CS3369: Real Time Computer Control Software"— Presentation transcript:

1 CS3369: Real Time Computer Control Software
Who I am: Dr. Lusheng WANG Dept. of Computer Science office: Y6429 phone: web site: 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

2 Suggested References:
D.M. Auslander and C.H. Tham, “Real-time software for control: Programming examples in C”, Prentice Hall, USA, 1990. S. Bennett, “Real-time computer control: An introduction”, Prentice Hall, UK, 1988. Babu Joseph, Real-time personal computing (for data acquisition and control), Prentice Hall, Englewood Cliffs, New Jersey, 1989. P. Norton, P. Aitken, R. Wilton, “PC Programmer’s Bible”, 1993. Turbo C, User Guide, ver. 2.0 Borland International, 1988 Dr. James T. Smith, “Advance Turbo C”, McGraw-Hill Book Company, 1989. H.M. Deitel and P. J. Deitel, “C++ How to program”, Prentice Hall, 1998. 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

3 Four Parts of the Course:
Introduction to real time systems and basic computer organization Real time scheduling Real time system development methodology Real time programming 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

4 CS3369 Real Time Control Software/WANG Lusheng
What I Cover: some basic concepts in real time embedded systems computers organization programming in C++ interrupts and controls top down design requirements specification program testing 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

5 Evaluation of the Course
Course work: 40% Two Assignments. 20% each. I give you time in the labs to do the two assignments. Project: optional. 10% bonus for the course work. A final exam: 60%; 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

6 CS3369 Real Time Control Software/WANG Lusheng
How to Teach Contents are divided into four classes 1. Basic part -- every body must understand in order to pass 2. Moderate part -- most of students should understand. Aim at B or above. 3. Hard part -- used to distinguish students. Aim at A or above. 4. Fun part -- just illustrate that some interesting things can be done if one works very hard. -- useful knowledge that will not be tested. 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

7 CS3369 Real Time Control Software/WANG Lusheng
How to Learn 1. Attend every lecture and tutorial. (4 hours per week) 2. Try to go with me when I am talking 3. Ask questions immediately 4. Try to fix all problems during the 2 hours tutorial 5. Ask other students to help during the lab. Every student should be able to finish basic part in tutorial/lab. Most of students should be able to finish the moderate part in tutorial/lab. If you do the above, you should be able to get at least B+. 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

8 CS3369 Real Time Control Software/WANG Lusheng
Real Time Embedded Systems Computer systems that operate as an integral part of physical systems, and very often, react and readjust control variables quickly to the changes in physical systems. Functionality: monitor equipment performance timely control equipment operations provide human-machine interfaces 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

9 CS3369 Real Time Control Software/WANG Lusheng
Three types of Real Time Embedded Systems Hard: Each job enters the system with a deadline before which it has to be served. Later response is not allowed. Soft: The average response time for the jobs is to be minimized. Firm: A combination of soft and hard real time requirements. 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

10 CS3369 Real Time Control Software/WANG Lusheng
Examples of Real Time Embedded Systems: Air-conditioning Control Elevator Control Traffic Light Control Video Games TV Remote Control 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

11 Introduction to Computer Hardware
We will learn the following: 1. Architecture of computer hardware 2. Execution of an instruction 3. Execution of a program 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

12 Basic hardware components
Central Processing Unit Memory Input/Output Sub-systems Buses 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

13 Architecture of Computer Hardware
cpu Peripherals General Purpose Registers Arithmetic and Logic Unit Control Unit Main Memory Input/Output Interfaces data/address/control buses 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

14 CS3369 Real Time Control Software/WANG Lusheng
What Does a Computer Do? Do some computation according to users’ willing 1. Users tell computers what to do via programs. 2. A program is a sequence of instructions. 3. Instructions are the basic operations computers can do. 4. Examples of Instruction add 2, sub 4, 2 (compute 2 + 3) (compute 4 - 2) 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

15 CS3369 Real Time Control Software/WANG Lusheng
An Example of a Program The instructions are executed sequentially There are some instructions allow jump x=3*5+6-7; (High level language) x=3; (Low level language) x=x*5; (A set of instructions) x=x+6; x=x-7; 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

16 Central Processing Unit (CPU)
Execute program stored in the main memory by fetching their instructions, examining them and then executing them one after another Components of CPU 1.Arithmetic logical unit (ALU) – performs operations such as addition and boolean AND needed to carry out the instructions 2.Registers – high-speed memory used to store temporary results and certain control information used by the CPU. CPU registers such as program counter (PC), instruction registers (IR), status registers 3.Control unit (CU) – fetching instructions from main memory and determining their type 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

17 CS3369 Real Time Control Software/WANG Lusheng
Memory part of the computer where program and data are stored and to be processed by the processor Also called Main Memory, Random Access Memory (RAM) Bits - the basic unit of memory is the binary digit, a bit contains a "0" or "1". Memory contains many bits organised in linear order. Several bits form a “cell” containing a piece of information (data, instruction, integer, character, etc) The size of the cell can be a byte or several successive bytes. Each cell has a reference number, called its address, by which program can refer to. 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

18 CS3369 Real Time Control Software/WANG Lusheng
Buses Communication links allowing data, instructions and memory addresses to be referred between different components (CPU, main memory and I/O devices) in a computer system. Example: UNIBUS - Digital Computer Inc., PC Bus - Industrial Standard PC bus Peripheral Component Interconnect (PCI) Bus 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

19 CS3369 Real Time Control Software/WANG Lusheng
Input/Output Device Input Devices Allows computer user to issue commands, asks for information, adds new data and programs to the computer. The computer receives input from the press of a key or button, touch of a finger on a screen, optical scanners, spoken words and many sources. Output devices Display results to the user. Includes video display screen, printers, audio speakers. 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

20 CS3369 Real Time Control Software/WANG Lusheng
General Purpose Registers Arithmetic and Logic Unit Control Unit data/address/control buses Main Memory Input/Output Interfaces real-time clock digital signals pulse operations analog-to-digital conversion digital-to- analog disk drive CD Drive printer Key board …... Display 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

21 Execution of an Instruction
Fetch the instruction from the memory Execution of an instruction is achieved by a sequence of commands issues by the control unit. Fetch the operands from the memory Perform the operation Update the program counter no Check interrupt yes Interrupt processing Next Instruction 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

22 CS3369 Real Time Control Software/WANG Lusheng
Execution of a Program Fetch the instruction from the memory Fetch the operands from the memory Perform the operation LOAD b, R1 Update the program counter A program is a sequence of instructions. no Check interrupt yes Fetch the instruction from the memory Fetch the operands from the memory Perform the operation ADD R1, 1 Update the program counter a = b + 1; no Check interrupt yes Fetch the instruction from the memory Fetch the operands from the memory Perform the operation STORE R1, a Update the program counter no Check interrupt yes …... 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

23 CS3369 Real Time Control Software/WANG Lusheng
Computer Languages Users use languages to write instructions and programs. There are lots of computer languages that can be classified into two categories -- low level and high level languages Low Level Languages: Machine language -binary code Assembly language Examples of Low Level Languages: ADD A3, D Assembly instruction Machine language 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

24 High Level Computer Languages
English-like languages -- easy to handle for users -- computers cannot directly understand Examples: C, C++, PASCAL, LISP, COBAL, etc Running a program written in high level languages: 1. Compile the program (translate the high level language into a machine language. Done automatically by a software called compiler.) 2. Execute the translated code. (executable code) 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

25 CS3369 Real Time Control Software/WANG Lusheng
The First C Program #include<stdio.h> int main(void) { printf(“Hello, world! \n”); return 0; } Output: Hello, world! \n stand for “new line” It will not be shown on the screen 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

26 CS3369 Real Time Control Software/WANG Lusheng
The First C++ Program #include<iostream.h> /* to include the file iostream.h */ int main(void) /* part of every C++ program */ { /* { The beginning of main function */ cout <<“Hello, world! \n”; /*print out Hello, world! On screen */ return 0; /* exit a function */ } /*} The end of main function */ Output: Hello, world! \n stand for “new line” It will not be shown on the screen 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

27 The first program for computation
#include <iostream.h> Note that, there are three variables x, y, and z. All are of type integer. int main(void) Each integer variable can store { an integer. The variable itself has int x,y;z; an address, which is automatically assigned by the system (computer). x = 1; y = 2; z = x+ y; cout <<“The sum of x and y is” << z; return 0; } 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

28 The address of a variable
In C, the address of a variable can be known by user. #include <iostream.h> int main (void) { int x; cout <<“The address of x is” << &x; return 0; } Output: Note that, each execution gives a different address. Exercise: Try to run the program three times. What happens? 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

29 Examples of C++ Programs We Intend to Deal with
Print out a person that can move Some program about graphics (G1 and G2) Time Delay-- create movies (G3, also person) Move keys with interrupts (key) 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng

30 CS3369 Real Time Control Software/WANG Lusheng
Summary 1. Real time embedded systems. 2. Computer architecture 3. Memory 4. Execution of instructions and programs. 5. C++ 9/21/2018 CS3369 Real Time Control Software/WANG Lusheng


Download ppt "CS3369: Real Time Computer Control Software"

Similar presentations


Ads by Google