1 / 30

CS3369: Real Time Computer Control Software

CS3369: Real Time Computer Control Software. Who I am: Dr. Lusheng WANG Dept. of Computer Science office: Y6429 phone: 2788 9820 e-mail: lwang@cs.cityu.edu.hk web site: http://www.cs.cityu.edu.hk/~lwang. Suggested References:.

varden
Download Presentation

CS3369: Real Time Computer Control Software

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS3369: Real Time Computer Control Software • Who I am: • Dr. Lusheng WANG • Dept. of Computer Science • office: Y6429 • phone: 2788 9820 • e-mail: lwang@cs.cityu.edu.hk • web site: http://www.cs.cityu.edu.hk/~lwang 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. 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 CS3369 Real Time Control Software/WANG Lusheng

  4. 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 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%; CS3369 Real Time Control Software/WANG Lusheng

  6. 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. CS3369 Real Time Control Software/WANG Lusheng

  7. 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+. CS3369 Real Time Control Software/WANG Lusheng

  8. 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 CS3369 Real Time Control Software/WANG Lusheng

  9. 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. CS3369 Real Time Control Software/WANG Lusheng

  10. Examples of Real Time Embedded Systems: • Air-conditioning Control • Elevator Control • Traffic Light Control • Video Games • TV Remote Control 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 CS3369 Real Time Control Software/WANG Lusheng

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

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

  14. 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, 3 sub 4, 2 (compute 2 + 3) (compute 4 - 2) CS3369 Real Time Control Software/WANG Lusheng

  15. 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; 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 CS3369 Real Time Control Software/WANG Lusheng

  17. 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. CS3369 Real Time Control Software/WANG Lusheng

  18. 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 CS3369 Real Time Control Software/WANG Lusheng

  19. 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. CS3369 Real Time Control Software/WANG Lusheng

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

  22. Execution of a Program Fetch the instruction from the memory Fetch the operands from the memory LOAD b, R1 Perform the operation 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 • STORE R1, a Perform the operation Update the program counter no Check interrupt yes …... CS3369 Real Time Control Software/WANG Lusheng

  23. 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, D5 Assembly instruction 1101 101 001 001 011 Machine language 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) CS3369 Real Time Control Software/WANG Lusheng

  25. 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 CS3369 Real Time Control Software/WANG Lusheng

  26. 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 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; } 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: -134219164 Note that, each execution gives a different address. Exercise: Try to run the program three times. What happens? 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) CS3369 Real Time Control Software/WANG Lusheng

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

More Related