Computers in Engineering - 308-208 Lecture 2
Computers in Engineering - 308-208


Lesson 2 - Learning Goals



2.1 Review of quick quiz

2.2 Computer Concepts and Terminology

2.3 Learn the Four basic data types

2.4 Learn how to use the Assignment statement

2.5 Learn about the Accuracy of numeric results



Computer Concepts and Terminology Review

COMPUTER ARCHITECTURE OVERVIEW

The Von Neumann Model

1. Programs and Data both in main memory

2. One CPU - Central Processing Unit

3. Program instructions fetched, decoded and executed by CPU

4. Data is loaded from memory into CPU registers.

5. Operations + - * / < = > performed by CPU

6. Results stored back in data area in memory


HIGH LEVEL COMPUTER LANGUAGE


LOW LEVEL COMPUTER LANGUAGE


Source Module

- a program in one of the above languages.

- created with an Editor

Compiler

- a translator from source to binary form produces an object module

( *.OBJ in DOS )

Linker

- combines object module to create an executable module (*.exe)

- also searches libraries for routines (e.g. SIN, SQRT, etc.)

System Loader

- finds executable on disk and place them in RAM

- starts execution


HARDWARE TERMS

CPU

- Central Processing Unit

RAM

- Random Access Memory

- Main Memory program must be in RAM before they can execute

ROM

- Read Only Memory

- special systems area for startup

Hz

- Hertz = 1 cycle per second

Mhz

- 1 million Hz (used to measure CPU speed - 75,90,100,200,300,400,...)

BIT

- Binary digIT ( 0 or 1)

NIBBLE

- 4 BITS !! (e.g. 1010 in binary = 10 decimal )

BYTE

- 8 bits (used to store a character)

KB

- Kilobytes = 1024 bytes

MB

- Megabytes = 1024 KB

DISK

- Hard disks for permanent storage.

FLOPPY DISK

- 3.5'' stores 1.44 MB (removable, transportable).

CD ROM

- Compact Disk ROM store 633 MB of read only storage.

MODEM

- MOdulate/DEModulate (to communicate between computers)

BAUD

- Bit/second (measure of data bandwidth (14.4KB, 28.8KB, 33.6KB...)

PARITY

- A check bit used to verify communications. Can be EVEN, ODD or

NONE. A count of the 1 bits.

VGA

- Video Graphic Adapter - 640 x 480 , 256 colours

SVGA

- Super VGA ( 1024 X 768 )

Also...

- 1280 X 1024


SOFTWARE TERMS

FIELD - A group of characters ( e.g. Last Name, ...)

RECORD - A group of fields ( e.g. Name, Address, Grades, ... )

FILE - A group of records (e.g. Source module,...)

DATABASE - A group of files (e.g. McGill Student Records, ... )


CHARACTER CODING SYSTEM

EBCDIC - Extended Binary Coded Decimal Interchange Code used on IBM mainframes (an 8 bit code )

ASCII - American Standard Code for Information Interchange used on microcomputers ( a 7 bit code )

UNICODE - New 16 Bit Code for ALL languages : Chinese, Japanese, Arabic, etc.


PROGRAMMING TERMS

VARIABLE

- A quantity that can vary

- A location in RAM

- A NAME for one of the above

DATA TYPE

- One of a number of different types of data

- INTEGER, REAL, CHARACTER, LOGICAL

- Main ones used in 308-208.

DATA CONSTANTS

- A constant of one of the types above

- e.g. 27   3.14159   'JEAN'   .FALSE.


DECLARATION STATEMENTS

- Used to define the types of data and variables.

   IMPLICIT NONE

INTEGER :: I,MAX,AGE

REAL :: SUM,TOTAL,Z

CHARACTER :: LAST,FIRST,TITLE

LOGICAL :: SINGLE,DRIVER


ASSIGNMENT STATEMENTS

- Used to do calculations and assign new values

   AGE = 19

Z = -5.7

TOTAL = 0.0

TOTAL = TOTAL + Z

LAST = 'SPILLER'

DRIVER = .TRUE.

I/O - INPUT/OUTPUT

- PRINT and READ statements in FORTRAN

   READ *, TITLE, LAST, AGE

PRINT *, LAST, AGE


ARITHMETIC PRECISION

102   101   100   10-1   10-2   10-3

0     1     2     3      3     3

= 0x102 + 1x101 + 2x100 + 3x10-1 + 3x10-2 + 3x10-3

= 12 333/1000 = 12 1/3 (approx.)
How can you tell what ''12.333'' is ''exactly'' ?

What is ''exact'' in one base may not be ''exact'' in another.

In decimal, 3.6 is ''exact'', but in binary,

3.6 = 1x21 + 1x20 + 1x2-1 + 0x2-2 + 0x2-3 + 1x2-4 + 1x2-5 . . .

    = (11.100110011001...) 2 = ( 11.1001 )2

and thus can NEVER be represented ''exactly'' no matter HOW many digits you have !


! TEST ACCURACY OF REAL

! NUMBERS PROGRAM ACCURACY

PRINT *, 1.0E0 PRINT *, 1.0E2 PRINT *, 1.0E4 PRINT *, 1.0E6 PRINT *, 1.0E8 PRINT *, 1.0E10 STOP END PROGRAM ACCURACY

PROGRAM OUTPUT :
1.00000000
100.000000
10000.0000
1000000.00
100000000.
0.999999898E+10 

On to the next lecture
Go back to lecture menu

Copyright © 1996 McGill University. All rights reserved.