Adobe Scan 01 Feb 2024
Adobe Scan 01 Feb 2024
5
Programming of Microprocessors
61 INTRODUCTION
Acomputer can only do what the programmer asks to do. To perform a particular task the
ng the res programmerprepares a sequence of instructions, called a program. Aset of programs
D line. See
romputeris known as
particular written for a
softwvare for that computer. The program is stored in RAM.
takesoneinstruction of the program at a time from RAM and executes it. It executes all theThe CPU
instruc-
tionssof the program one by one to produce the desired result. Acomputer uses binary digits for its
oneration and understands information composed of only zeros and ones. Hence, the instructions
the restart areaodedand stored|in the memory in the form of zeros and ones. Aprogram written in the form of
Intel 8085. Nand 1s is called amachine langage program. In the machine language there is aspecific binary code
each instruction. For example, for Intel 8085 to add thecontents of register Aand register B, the
ary code is 10000000. To move the content of register Bto register Athe binary code is 01111000.
ags remain tis tery difficult for the programmer to write a program in machine codes. Moreover, it is error
ne The demerits of machine language programs are :
1. Itis very difficult to understand ordebug a program.
2 Since the each bit has to be entered individually the entry of a program is very siow.
group. 3. Programs are long.
bles for each
4. Program writing is difficult and tiresome.
5. Chances of careless errors in writing the program.
d: Aprogram written in machine codes ultimately becomes a
set of binary numbers. A machine
in memory locations 2501 and
language program is shown below for adding two numbers placed
303. The result is to be placed in memory location 2503.
Machine codes a Comnents
in H-L pair.
00100001 Get the address of the 1st number i.e. 2501
00000001 LSBs of 2501
00100101 MSBs of 2501 (i sgas 6
accumulator.
01111110 Get the 1st number in
00100011 Increment content of H-L pair.
the 1st number.
10000110 Add the 2nd number to
00110010 Store sum in 2503H.
00000011 LSBs of 2503
01110110 Stop.
MICROPROCESSORS AND
5.2
FUNDAMENTALS OF
MICAOdatCOaMPUTERS
Now data are to be entered. For this example data are two numbers say 15 and 20, and hey ate
and 2502 respectively. The memory address and.
to be placed in memory locations
form are written as follows:
DATA
2501
inbinary
Data
Memory address
0010010100000001 00010101
0010010100000010 00100000
in hexadecimal system. The proers
To facilitate programmer machine codes can be written system. The mistake can easil.
easily be written in hexadecimal system compared to binary system is as follows.
detected. The program for the addition of two numbers in hexadecimal
Machine code Comments
21 Get the address of the 1st number, i.e. 2501H in H-L pair.
01 LSDs of 2501H
25 MSDs of 2501H
7E Get the 1st number in accumulator.
23 Increment content of H-L pai.
86 Add the 2nd number to the 1st number.
32 Store sum in 2503H.
03 LSDs of 2503H
25 MSDs of 2503H
76
Stop.
DATA
2501 OF
2502 14
MICROPROCESSORS 5.3
OF
:
PROGRAMMING
DATA
2501 - 49H
2502 56H
MICROCOMPUTERO,
Result:
2503 - 9F
Mnemonics, operands, data of the program and starting address for the program are
computer. The assembler converts the program into a machinelanguage program before fed to the
tion of the program. the
execu-
In an ordinary kit assembler is not available. The programmer first of all
writes program in as-
sembly language and then fills up the machine code corresponding to each mnemonic.
hand assembly. The codes are written in hexadecimal system. The hexadecimal codes .Thisis called
microcomputer using keyboards. In microprocessor kits there is an arrangemnent are fed to the
hexadecimal codes into binary codes. The program for the addition of two numbersfors
language with hexadecimal codes is given below : in
assembiy converting
Memory Machine Mnemonics Operand Comments
address Codes
2000 21, 01, 25 LXI H, 2501 H Get the address of the 1st
number in
2003 7E MOV A,M
HLpair.
The 1st
2004 23 INX
number in accumulator.
H
2005 86 ADD M
Increment content of H-L pair.
2006 23, 03, 25 Add 2nd number to the first
STA 2503 H number.
2009 76 Store result in 2503 H.
HLT
DATA Stop.
2501 -49 H
2502-56 H
Result:
2503-9F
The
easier to programmer writes a program in mnemonics
understand faster to write. Then he fills up(assembly
and
microcomputer. This is atime the machinelanguage)
codes
with comments as
hand assembly. which
consuming, tiresome and boring job. There are chances
are to be fed tro ut
The advantage of of errorsin
is that the assembly
time is language over
computation
level languages have been ess. An assemblyhigh level larnguage, such as FORTRAN, COBOLLetc.
The discussed in the language program is faster to produce result. High
subsequent
1. disadvantages
Programming
of assembly
language
is difficult and time as section.
compared to high-level languages are :
2. The consuming.
assembly language is computer
detailed oriented. The programmer is required to have the
registers knowledge
and
of the
particular
connections instructions
of ports to the the microcomput
microcomput er er he is using. He must know what
has, how affect registers;
3. Assembly y equipment to be
language program is not portablecontrolled etc. instructions
i.e. the
program written for one microcomputer
PROGRAMMING
GOF MICROPROCESSORS
5.5
used| for any other because cach
cannotbe microcomputer has itsaown
The programmer has to write his own program to perform assembly
particular language.
task. Library
facilities.for assembly language programs are not available.
4. An assembly language programis longer as cornpared to a high-level language prograrn.
Each statement in a high-level language corresponds to many assenbly language
instructions.
5.6
FUNDAMENTALS OF
C++. Itis.an extension toClanguage.C++ is the superset of C(the commands of Clanguage are
C++). Astatementin Cis also a correct statement in C++, but thereverse is not true. It was
subsetof a Bell laboratoriesin the year 1980 by Bjarne Stroustrup. It is an object orientedlanguage.
developed
lat
high-levellanguages discussed earlier such as BASIC,. COBOL, FORTRAN, Cetc are not ob-
(Other
jtorientedlanguage,rather they are procedure-oriented language. In an object-oriented language,
while writing a program,the program1ner tells Only'what to do'. In a procedure-oriented language,
riting the prOgram the programmer has to tell'what to do' as wellas 'how to do'. OP'stands
ct-oriented programming. InOOP'objet' and 'class' are involved. C++ provides a collection
predefined classes. It also supports user-defined classes. Now-a-days object-oriented program-
ot swidely used.C++ is a very powerful and efficient language, but it is also difficult to learn.
is used towrite system sottware and commercial software packages such as operating ss
opilers,word processing, spreadsheet, database management, various types of specific ap
plication programsineeded for business ànd commercial applications, etc. C++ is replacing assembly
nuage in somelow-level machinecontrol software. Assembly language is also interspersed with
machine control functions efficiently.
C++to perform
C#. It is a java-like programming language developed by Microsoft recently. C# is pronounced
s 'see sharp'. Its codes are similar to Java, but it is not aJava clone. But it lacks cross-platform
capability which Javahas.Carnd C++ applications take longer time to develop. These languages are
äitficult and application programs become complex. Programmers need a language which is
powerful, efficient and quick to develop softwares. To meet these requirement C# has been
developed. It is a modern object-oriented language that enables programmers to develop new ap
features which
plication programs. C# is a hybrid of C and C++. It is closer to C++. It offers some
are available in Java but not in C or C++. It is a challenge to Java which is an established language
is to be seen
for cross-platform. Java is widely used for Internet applications.The performance ofC#
in the future.
Active XApplication Programs. They are just like Java applets. They have been developed by
can
Microsoft. They are written as components using which larger and more complex applications
be developed. They are just like building blocks of large and complex programs. They can be
downloaded from Internet. To run these application programs, a browser which supports Active X,
such as Internet Explorer, is needed.
It was
PROLOG. It stands for programming Logic. It is suitable for artificial intelligence. Using
developed in 1972 at the University of Marseillers. It is capable of handling large databases.
thas language rules-based application software suitable for expert system can be developed.
LISP. Itstands for List Processing. It was developed in early 1960s by MeCarthy. This language
for artificial
IS also suitable for artificial intelligence. Both PROLOG and LISP are excellent languages application.
htelligence applications. Their merits and demerits are examined for a specific space
TKOLOG needs less memory space than LISP and hence PROLOG is preferred where memorywhere
preferred
imited. LISP is more powerful in I/O handling and graphics and, therefore, it is
graphics and extensive use of I/O are needed.
used in com
As LISP is suitable for searching, handling and sorting long strings, it has been
Puterised translators.
mid 1960s. It
SNOBOL. It stands for String Oriented SymBOlic Language. It was develeped in
manipulate strings of characters and hence, it is used for text processing.
cOGO. It was developed at MIT in the late 1960s by Seymour Papertused and his colleagues. t has
for children as educa
bised in Universities for complex scientific problems. It has also been
al language to achieve intellectual growth and problem solving skills. Logo has graphic features.
5.8 FUNDAMENTALS OF MICROPROCESSORS AND
Children can draw, colour and animate images. It can also be used to compoSe music,
text, manage data etc. It runs on PCs.
MICAOCmaniOMPUpTulERaSt,e
APT. It stands for Automatically Programmed Tooling. It is used to control
manufacturing applications. machine tools in
JAVA. It is an object-oriented programming language derived from C**. It has been
by Sun Microsystems Inc.
on a computer
Applications written in JAVAare capable
of running on any platforro(:
system built around microprocessor of any manufacturer). It is suitable for
developed
desktop computers, servers, microcontrollers, etc. It is widely used for Internet applications.
is a JAVA program which is included in Web
document. Servlet is a program that handles.Atask
Internet,
pplet
server. Full-fledged JAVA based server is also available. JAVA
ment, JAVA Developer Kit is a tool set,and Java Script a Workshop development environ
is a
softwares based on JAVA provide developers enough resources scripting language based on JAVA.These
HotJava is a machine-independent interpreter for browsers. Java for programming at the desktop
Sors optimised to run Java based business and chips are dedicated microproces
embedded applications.
called Picojava. Pico]ava core design is the base for the Sun has developed a 'Core
Java' specification
MicroJava is microcontroller based on Picolava. This first-generation Java chips.
microcontroller has multimedia and graphics
capability.
JAVA has
Machine. It is cross-platform capability .
not a real machine. It is a How it achieved ? It is achieved using Java Virtul
is
memory. It does all major operations of a realsimulated computer which is stored in the computer's
machine codes, which are acceptable to Java machine. A Java compiler translates Java programs into
machine codes are known as virtual machine Virtual Computer (Java Virtual Machine). These
machine codes and gives an output. The output ofcodes. The Java Virtual Computer
java Virtual Computer is sent to a processes these
which gives machine codes for the Java Interpreter
computer
SQL. It stands for Structured Query which has to run Java programs.
query languages and has been adopted by Language. It is an international standard for database
INGRESS and INFORMIX. many database product supplier e.g.,
ORACLE, SYBASE,
1GL (First Generation
2GL (Second GenerationLanguage). Machine language is called 1GL.
Language). Assembly languages fall under the 2GLs. An
language is very close to hardware.
of the An assembly language assembly
microprocessor for which he is writing programs. programmer must know the architecture
3GLs (Third Generation
dure oriented languages. In theseLarnguages). High-level languages come under 3GLs. These are
how to do'. He has to write steps languages the programmer has to write 'what to do' as proce
FORTRAN,PASCAL, COBOL, C, etc. how to perform the desired task. Examples of 3GLswellareas
4GLs (Fourth Generation
oriented languages. While writing Languages). These are
the program in thesenon-procedural languages. These are object
what is to be done. Examples of 4GLS languages the programmer has to give ony
are : ORACLE, SYBASE,
higher-level than normal high-level languages. 4GLs are etc. 4GLs are considered to work at a
(Relational DataBase usually
System). Most 4GLs use SQL as a tool. C** application programs for RDBN
languages and hence, they come under 4GLs. and JAVA are also object-oriented
5.3.1 Advantages of High-Level
1. Instructions are very clear. Language
2. The writing of program in a
programs in assembly language. high-level language is easier and faster than the writing o
Acommon estimate is that the
program writing in a hug
5.9
:haAS hih-level langlldgS are otatle te they can run on any computer or
NInuter having st.a:dand ompler tor that language
Faserdinumentation.
1e pngan is idendent ot the stnctu of a particular computer The pogram iS
nlen i n irather thancomputer onentnd
Rianisnta.
times faster. In a
languageis about ten 5.9
level
writteninnoone pQ. The same
step: S = high-level language
thing in assembly
lines.
multiplitakes
anguage program caticonabout
can be
10
3 Programs in high-level languages are portable ie. they carn run
micocomputer having standard
Easier documentation. compiler forthat language on any
computer or
program is independent of the
4
5 The
poblem structure
oriented rather than computer orientedof aparticular
computer The
Standard syntax. program is
Disadvantages of High-Level
632 Languages
Onehastolearnthe special rules for writing
1.
speed. One statement in a high-level
programs in a particular high-levellanguage
: Low language corresponds to many instructions in
machine language. Hence, the high-level language takes
omputation time is more.
more time to produce resuit ie
3. Low efficiency of memory utilization..A program in high-level language occupies alarger
part of the memory.
4 Extensive hardware and software supports are required.
: Acompiler has to be proVided to convert a high-level language program into a machine
language program. The compiler is costly.
# AREAOF APPLICATIONS OF VARIOUS LANGUAGES
Each programming language has its own merits and demerits. Depending on the type of prob
.cost and situation a suitable programming language is selected. Though high-level languages
Ever convenient and powerful, they cannot be used in all situations. The cost of perip'erals such
sCompiler, floppy disk system, CRT etc. is very high. Asystem which can provide the tacility tor
ngh-level language, incorporates costly peripherals, and the total cost of the system lies in the range
tks 50,000 toa few lacs of rupees. Such costly system can be recommended where costly svstem is
*Controlled or more computations and large volume of data are to be handled. The main aim ot
Suroprocessor-based system is to provide inexpensive programmable controlling device. It iorms
part of a machine or equipment to be controlled. Most of microprocessor applications in auto
t COntrol, instrumentation, communication etc. are not suited to high-level languages. In such
plications from input dev ices and
receive data and status information
controlIsignals tosimply
ad data and microprocessors output devices. Forsuch applications the machine or assembly lan-
Siage is preferred. In a typical microprocessor-based system which is used for industrial control,
one. The program is not changed or
odistrfuiement
d ation etc., the progranm to be executed is a fixed
language and storedin EPROM at
etime ofbyf development
the user. Suchof atheprogram
system. written
is The in the machine
applications of ditterent programming languages are
sribed in the subsequent subsections.
Machine Language
The machine language is preferredfor the following situations:
1. For
smmalcontrol
2 Simple
3
l and simple programs.
applications whereless computation isrquired.
Applications where prototype is the final product.
5.10 FUNDAMENTALS OF MICROPROCESSORS AND MICROCOMPUTERe
used as stack. There is no restriction onthe location of the stack in the memory. Data are stored in the
stack on last-in-first-out (LIFO) principle. Stack access is faster than memory access. Fig. 5.1 shows a
typicalstack and stacktop location. The SI' register holds the address of stacktop location. Fig. 5.2 (a)
shows the position of astack before PUSH operation. Suppose that the conternts of the register pair
B-C is to be pushed. After PUSH operation the stack position has been shown in Fig. 5.2 (b). Similarly,
POP operation is used to transfer the contents from the stack to the register. The stack position before
and after the POP operation has been shown in Fig. 5.3(4)and (b) respectively.
PUSH B REG B REG C
2A
REG B REG C
2602 03 2A
2608 68 2608 6B
Fig.5.2 (a). Stack before PUSH operation. Fig.5.2 (b). Stack after PUSH operation.
2608 1 2608 19
Fig.5.3 (a). Stack before POP operation. Fig. 5.3 (b). Stack after POP operation.
5.6 SUBROUTINES
While writing a program certain operations may occur several times and they are not available
as individual instruction. The program for such operations are repeated again and again in the main
program. Asimple example of such operation is multiplication. The Intel 8085 does not have any
instruction for multiplication and hence, aprogram is written to perform multiplication. Similarly
small programs are written for functions like sine, cosine, logarithm, square root etc. for Intel 8085.
The concept of subroutines is used to avoid the repetition of smaller programs. The small program
foraparticular task is called subroutine. Subroutines are written separately and stored in the memory.
ANDMICROCOMPUTERS
5.12 FUNDAMENTALSOF MICROPROCESSORS
The hardware of a computer system can not do anything by itself; software is required to direct it
what to do.The system software is acollection of programs written for acomputer which allows user
to develop andrun his program. The system software is stored in ROM/Disks. It includes operatirg
system, BIOS, assembler, cornpiler, editor, etc. An operating system is a collection of programs. It
controls the overall operation of a computer. It provides programmers an interface to a computer.
Asimple operating system is called a monitor. Amicroprocessor-kit or a
system is provided with a monitor. It resides in a ROM microprocessor-based
or EPROM. PCs, minicomputers and large
computers are provided with an operating system. It resides on hard disks.
5.7.1 Monitor
Amonitor is a program which resides in a ROM or PROM. It carries out the
(i) Initialisation of the system following functions:
(ii) Loading of programs into RAM.
(iii) Control of input and output devices.
(iv) Displaying of the contents of internal CPU
(v) Modifying the contents of CPU registers or registers or memory location.
(vi) Executior of the program which is in RAM or memory location.
ROM.
In a mícroprocessor kit a monitor
ging programs like controls its entire operation. It contains subroutines for
debug
mands like INSERT,single step operation and program for inserting
DELETE, breakpoint. It also contains com
user in entering and executingDELAY, RELOCATE etc. It controls CRT terminal, printer etc. It helps
machine code program.
In an MDS or
sophisticated microcomputer, minicomputer or large
BIOS there ís a powerful
tion of BIOS is to load theoperating system. The operating system is stored oncomputer in addition to
a disk. The major
operating system into RAM,and to control basic func
5.7.2 Operating System input/output operations.
An operating system of a
sible for managing files on thecomputer is the main component of the
disks and communication system software. It is respon
memory space management, job scheduling etc. It is a between the computer and peripherals.
usually stored on disks. program or collection of programs which
are
PROGRAMMING OF MICROPROCESSORS 5.13
built by hundreds of programmers scattered around the world. The goal has been to develop a UNIX
LINUX
clone, free of any commercially copy righted software, that the entire world can use. Actually, a more
was started by acomputer science student named Linus Torvalds. He wanted to develop
robust version of UNIX. His desire was to develop the replacement of the Minix operating system
which was developed by Professor A. Tannebaum. The Minix System was written to demonstrate
severalcomputer science concepts found in operating systems. Torvalds included these concepts
intoa stand-alone system that mimics UNIX. He named it LINUX. It includes most of the commands
of UNIX. LINUX runs on widely available IBM PCS. It also runs on DEC Alpha, SUN SPARCS,
PowerMacs, etc. It comes with complete implementation of TCP/IP networking protocol. TCP
stands for Transmission Control Protocol. IP stands for Internet protocol. TCP/IP is the largest
protocol standard functioning on both LANs and WANS. It provides error checking, flow control (to
prevent swamping of auser by another faster or more powerful user), and status and synchronous
control.TCP works with IP. They are simply different layers of control. TCP is transport layer. IP is
network layer which handles routing and delivery. With LINUX one can connect to the Internet. It
also provides a complete E-mail system. It also has a complete graphical user interface (GU) using
X-Fre 86 which is based on X-Windows system. The X-Windows system is a powerful graphical
environment that supports applications across a network. It was developed at MIT and can be freely
distributed. Anumber of applications programs are available today which can run on LINUX. Ex
amples are :application programs for databases, wordprocessing, telecommunication,wide range
of games, etc.
5.7.7 Intel RMX 86
It is a multitasking operating system for real-time industrial control. It works on the principle of
priority-based scheduling. UNIX works well for a multiuser time-share system. But it is not suitable
for real-time industrial control which requires operation on priority basis. It is not fast
enough to suit
the requirement of real-time control.
5.7.8 WINDOWS Family
INTRODUCTION. Microsoft corporation developed agraphical user interface (GUI) in the year
1990, called WINDOWS. It provides menus and icons (small
representative pictorial images) to in
teract with the computer instead of typing commands. It presents
menus arnd graphical symbols. WINDOWS was not an operating system.programs, procedures and files as
It was simply a computer
software. It was working under DOS operating system. Its different versions were WINDOWS 3,
WINDOWS 3.1 and WINDOWS 3.11. It was a slower system.
Later on Microsoft developed WINDOWS 95,
(Millennium Edition), WINDOWS NT, WINDOWSWINDOWS 97,WINDOWS 98, WINDOWS Me
2000 , 2003 and WINDOWS XP operating sys
tems. The operating system WINDOWS95,97, 98 and Me were for single user
NT and WINDOWS 2000, 2003 for multiuser system i.e. a computers. WINDOWS
system WINDOWS XP. It includes features of
is for computer network. The latest operating
as WINDOWS NT& 2000 series. XP stands forboth series WINDOWS95,97,98 and Me series as well
DOWS XP Professional and WINDOWS XP Home. eXPerience. WINDOWS XP has two versions:WIN
The
more powerful than Home version. The Home version isprofessional version is for business users. It is
for consumers or home users.
WINDOWS -95 is amixed 16-bit and 32-bit multitasking single user
provided with graphical user interface (GUI) of Microsoft, operating system. It is
tures like virtual memory process management and called WINDOWS. It includes the fea
have the limitation of memory addressing capacity. DOSmultiprogramming. Unlike DOS it does not
has the
WINDOwS 95 takes full advantage of memory addressing capacity memory limitation of 640KB.
of a 32-bit microprocessor. It
PROGRAMMING OF MICROPROCESSORS 5.17
always runs in protected mode. It uses long file name in place of 8+3 character file names allowed in
MS-DOS. It does not eliminate MS-DOS completely. It includes MS-DOS version 7to run DOS ap
plications, to provide some low-level BIOS support on non-plug and play machines and to support
antiquated devices that use real-mode drivers.
WINDOWS-98 is an enhanced version of WINDOWS-95. It is faster and easier to use. It is a
complete operating system provided with agraphical user interface. It provides multitasking and
multiple windows. It does not require as many mouse clicks and double clicks as required by pre
vious versions. It includes a new program called Outlook Express that manages both E-mail and
newsgroup informations. Newsgroups are thousands of lists, arranged subjectwise, that contain
messages and files that users can post and read. It allowsusers to manage incoming and outgoing
messages easily. The Internet's online environment is more closely associated with Windows-98
desktop. The start menu is more operational and allows users to make menu on the fly without
messy dialogue boxes. Improved Plug-and-Play features enable users to plug new devices into the
computer without having to set hardware switches or determine appropriate interrupt settings. Ad
vanced system tools now help protect user's computer files and monitor hardware. Windows-98
supports universalserial bus (USB), advanced laptop docking and infrared ports. It has 32-bit en
vironment.
It has web integration that blurs the distinction between PCon the desk and the Internet. It
provides Web-based desktop environment. One can place Web pages right on the desktop instead of
accessing the Internet solely from an Internet browser program. If someone wants help, he can search
Windows-98 help files or access Internet to locatea help topic -all from within the desktop environ
ment. It helps you access the Internet as easily as you access the files on your own PC. It provides
more efficient disk storage system called FAT32 which makes hard disks of holding almost twice as
much as before.
Windows-98 provides a feature known as Direct Cable Connection which allows transfer of files
between computers without need of a network and without moving data between the PCs via disk.
When two computers are connected through a high-speed parallel or serial cable, those computers
can share files and printer resources with one another. This is asimple replacement for an expensive
network if someone wants only two computers to share resources.
WINDOWS Me. Microsoft launched WINDOWS Me, an improved version of its operating sys
tem for home PC users,in the year 2000. Me stands for Millenium.It is largely an extension of WIN
DOWS-98. WINDOWS Me is provided with new and improved music, film, digital photo and
Internet features. It contains Windows Media Player 7, Movie Maker and Internet Explorer version
5.5. It makes PC technology simpler and the Net (computer network) more accessible.
WINDOWS-NT (WINDOWS New Technology). It is a 32-bit multitasking, multiuser operating
system. It provides graphical user interface. It has been developed by Microsoft. It has networking
feature. It gets rid of DOS altogether. It is not restricted to only Intel microprocessors. It is also used
with microprocessors of other manufacturers. It is used for PowerPCs, DEC's Alpha, MIPS proces
sors, etc. It uses preemptive multitasking. It is based on client/server principle which is commonly
used in network computing system. Aserver is acomputer which offers services for other computers
on the network. Services may be any kind of program-routine or data provided by the server. For
example, aserver may provide information froma database which you do not have direct access. A
client is acomputer which gets services from aserver. The client makes contact with aserver on the
network and requests for some sorts of services. It supports TCP /IP, IPX/SPX, data link control for
mainframes, Apple Talk (a packet protocol) for Macintosh network integration, Network File System
created by Sun, etc. TCP is Transmission Control Protocol, IP is Internet Protocol, IPX is Internet
oOFF 99i1555900, 95218218A
5.18
Packet
EXTRA|
FUNDAMENTALS
N vIsTING GUR
OF
MICROPROCESSORS AND
Porate asExchange, and so on.
teatures
well as in small and
WINDOWS-XP
of both
is an
WINDOWS-NT
medium
operating system
the features of a single user operating systemdeveloped
XP stands for networking
becamethe preferred
size enterprises.
such as
operating
by Microsoftin the
year 2001.
MICROCOMPUTERS
system in
l arge cor-
operating WINDOWS 98 and .It
WINDOOWS-XP
is for
eXPerience.
Media
It
Center
has four system n
(multiuser
versions:WINDOWS-XP
Edition and
WINDOWS includes
system) such as WINDOWS Me as welltheas
and servers. It isThefor professionals and WINDOWS Tablet PCProfessional,
consumers.
operating system for single professional
user and
business applications.
version is the superset
Edition.
The
of Home home version
The WINDOWS-2000.XTPhe
professional
is foor
term
Home,
vot
WINDOWS-XP
surf Internet.
people in Microsoft
other
adds features that smaller
make it
gives an interface called
system.
easier to download
Version. Today it is. home users
wid ely used
activitiesIt such as online
Over the Internet. luna with music, process digital photos, and
button but makes Net offers customers shopping,
a nmore
publishingphotosWINDOWS-XP.
to the Web, This interface helns
panel more intuitive. connectivity, E-mail streamlined Windows look. It and sharing
The access and
interaction retains the Windowsapplications
and TV WINDOWS-XP Media
Thethrough convenient user interface
a Center Edition allows users to
with system settings via
Start
control
WINDOWS-XP
capability.
as you
Tablet PC Edition is formakes easier everexperience
Users can use digital
that
to enjoy video, audio, pictures
would with a mouse. Also,penit isto write directly notebook computers. It digital media.
WINDOWS-XP and 64-Bit Edition has been
on the screen
provided with built in and control provides pen
their and speech
wireless computers just
WINDOWS-2000
DOWS-2000.
ferent versions: WINDOWS
It is a
multiuser
developed.
Server 2003.
Its
version 2003technologies.
is
available.
operating system withWINDOW-NT version5 was
WINDOW-2000 Advanced Server networking features. It wasrenamed as WIN
WINDOW-2000
WINDOW-2000 Server
Data Center
Server available in dif
WINDOW-2000
The Professional
WINDOWS-2000 Professional is for workstations and PCs.
types of servers.
WINDOWS
WINDOWS Server 2003 is a
Server 2003 providesmultiuser
Other versions are for
diferent
managingandand a operating
XML Web revolutionary system for
networks Webrunning from a services. It tois application
servers, developed in the year
WINDOW-2003 services
Standard Edition
a
workgroup dataplatform environment
for for
building, 2003.
deploying
powering connected applications,
center. Its different
WINDOW-2003 Enterprise Edition
WINDOW-2003 Data Center versions are:
WINDOW-2003 Web Edition Edition
5.7.9 Other Operating
Systems
SUN's Solaris. SUN's
user interface. It
supports Solaries version 2.6 is a
developed its own version ofnetworking and internet 32-bit operating system. It provides graphical
UNIX, called (TCP/IP), SUN's subsidiary SUNSOFT
OpenWindows. OpenWindows includes Berkeley
PROGRAMMING OF MICROPROCESSORS 5.19
derivative of UNIX alongwith its Open Laok graphical, look-and feel desktop manager. This entire
bundle is called Solaries.
SUN has developed 64-bit operating system Solaries version 7. Under Solaries 7installation and
administration have been made more user friendly with Wizards' and other user-oriented automat
1on tools. SPARC processors or Intel processors can run under Solaries 7. 64-bit Solaries 7 is
downward compatible with 32-bit programs and infact runs them faster than they run under the
32-bit operating system.
Solaris version 9 comes with several new features. It integrates various middleware and
management components. It integrates application server, directory server, security arnd Web ser
Vices. It is an operating system for UNIX server. The integration of middleware with Solaris 9 rnakes
iteasier to build and deploy applications and Web services based on Java, XML, and SOAP tech
nologies. SOAP stands for Simple Object Access Protocol. It is a useful protocol for Internet, intranet
and extranet.
Apple's Macintosh Operating System Mac OS 8.5,9 and X. Apple's Macintosh operating
system was the first operating system which used graphical user interface (GUI). It was widely used
on Apple's 680X0processor based computers. Its earlier versions were Macintosh Systern 7.x. For
PowerPC processor Apple developed Power Macintosh which was developed through 680X0
software processor emulation. For Power Macintosh Soft Windows is also available, which provides
a complete emulated Windows platform. The software emulates a high-speed 80286 processor and
runs most Windows software. This gives Power Macintosh a dual operating system capability. Mac
OS 8.5 is faster and it can easily be installed in less than 15 minutes. It costs about 100 dollars. Its
performance is 3 times faster when saving files over the network. It has improved internet search
functionality. From a single dialog box, auser can search files by content and search the Internet
using several different engines, such as Excite and HotBot, simultaneously. ColourSyn printout,
video, or Web site of what users see on their screen is an area where the Macintosh excels over Win
dows platform.
Macromedia Inc.'s Flash and Shockwave Internet applications player software is packaged with
Mac OS 8.5. Flash and Shockwave Web are applications which allow users to view and participate in
Internet multimedia content including games, animated interfaces, interactive demos, vector-based
Web graphics and cartoons, without having to download and install other plug-ins or software. The
Mac OS 8.5 has also new Web capabilities. The software has a tool named Sherlock, can search for
information on the Internet and on a desktop hard drive simultaneously.
Mac OS version 9 and X(ten) have also been developed. Mac OS Xis provided with the ease
of-use of the Mac and the power of UNLX,blended into a single operating system. It combines new
applications, ease-of-use and a brand new interface, Aqua. The Aqua interface brings Mac to life
with colour, depth, translucence and fluid motion. Buttons indicate active or non-active by glowing
and diming, icons are crisply rendered, and drop shadows give windows depth. Dock is an addition
to Mac OS interface, which holds folders, applications, documents, storage devices, minimized win
dows, QuickTime movies, digital images, links Web sites etc. The Mac OS Xcomes with a new
graphics engine, called Quartz, which is based on Adob's portable document format.
64-Bit Iris. It is a 64-bit operating system developed by Silicon Graphics Inc. It is being used
since 1994.
Novell Netware Version 5.0. It is a network operating system. It is a multitasking, multiuser
operating system. It fairly time slices between processes. Computers connected on the network share
files and resources like printers, plotters, storage devices and computing power. It also provides
electronic mail facility. When we compare the multitasking ability of UNIX and NOVELL Netware,
MICROPROCESSORS AND
FUNDAMENTALS OF MICROCOMPUTERS
5.20 his
multitaskingtothe userat workstation. On
extends theabilityof operatingsystem but does not: allow users
we findsome differences. UNIX multitasking
the other hand Novell Netware by itself is a
themselves ontheir
workstations.
to pertorm multitasking 3operations by
Internet environment besides traditional features of
in the resources. Version 5.0 offers
Novell Netware 5.0 offers services LAN to share files and
the s
on
providing facilities to computersservices, IPX-to-IP support which enablesIPX-based LANsto con-
centralised network management
nect to lP-based networks. bandwidthneefficiently, simplifies protocol
(lIP) uses network
Netware 5's PURE Internet integration with available solution. It also supports other Internos
tprotocol
management and offers better directory services. It also includes what is claimed to he
protocols, in its enhancements to the key
Machine (IVM) for server-based applications and services written in Java
word's fastest Java Virtual
Netware was widely used in LANS. Now situation is changing with the development of
Novell become now the competitor of
WINDOWS-NT which is also a network operating system, and it has in large cor
Novell Netware. WINDOWS NT has been preferred networking operating system
the market share of UNIX.
porates as well as in small and medium-sized enterprises. It is also grabing
5.7.10 BIOS
BIOS stands for Basic nput Output System. It is a set of programs to provide most basic low-level
services such as services for keyboard, disks, serial port, printer, display, bootstrap, etc. BOS programs
are stored ina ROM. The term ROM-BlIOS is also used. There is BIOS at operating system (OS) level also.
OS-BIOS povides services at user's level such as to create,edit, read, write file and so on.
When power is switched on ROM-BIOS takes the control of a computer. First of all, ROM-BIOS
programs for power-on-self test are executed. These tests check that whether the computer is in
proper working order; allunits of the computer are functioning or not. Check test is performed to
examine memory for defects and to see that the computer is not malfunctioning. After power-on-self
test is performed booting process is done. The process of loading the operating system into main
memory is called booting. ROM-BIOS contains a program called bootstrap loader. This
directs CPU to read from the disk a specific program called boot (a program
svstem) and to load it into the main memory. When this boot small portion of the operating
System is loaded into the main memory from the disk. Other program is executed, the operating
programs of ROM-BIOS are to analyse
system configuration, for I/O supports for disks, keyboard, CRT,
printer, etc.
ROM-BIOS chip is placed on the motherboardof the computer. Certain
controller, SCSI controllers, etc. may contain their own adapter boards such as
ROM-BIOS to control their own functions. VGA
5.8 SOME IMPORTANT COMMANDS
The microprocessor kits used in
checking, INSERT, BLOCK MOVE, DELAY laboratories have commands like DELETE, SINGLE STEP
etc. Some of these
5.8.1 INSERT commands are described below:
The INSERT Command
gram. The format issINS facilitates the programmer to insert one or more
(<LOLMT>)
ber of bytes to be inserted> NEXT (<HILMT>) NEXT
NEXT <Data> <Low Insert instructions in the pro
highest addresses of the user's NEXT, .., EXEC. LOLMT and Address> NEXT <Num-
program
first byte has to be inserted. When respectively.
INSERT The lowinsert HILMT are the lowest and
key is address is the
address field. LOLMT is i inserted and then next key ispressed some address will beaddress where the
displayed in the
are done in a sequence as showninin the
format. The pressed. Now HILMT is
kit press SHIFT before pressing INSERT key. above format is for inserted. ( Other entries
Professional''ss kit. For Vinytics
PROGRAMMING OF MICROPROCESSORS 5.21
5.8.2 DELETE
This command is used to delete one or more instructions from the program. The format is as
follows:
DEL(<LOLMT>)NEXT (<HILMT>) NEXT <Low
Delete Address> NEXT <High Delete Address> EXEC.
The low delete address is the address of the first byte to be deleted. High delete address is the
address of the last byte to be deleted. The above format is for Professional's kit. For Vinytics's kit
press SHIFT before pressing DEL key.
5.8.3 SINGLE INSTRUCTION
This command helps programmer to execute his program one instruction at a time. The format
isgoSlto(<Address>)
the
NEXT, ..,NEXT, EXEC, Exam. Memory or Register, EXEC, SINGLE INST, (it will
address where the program had been interrupted).
In case anew address is entered, the pressing of the next key displays the 1st byte of the instruc
tion stored at that location. Otherwise the pressing of the NEXd key executes the instruction at that
address.
In most of the cases a program does not run properly at irst trial. To detect errors the program
is executed one instruction at a time. The corrections aremade and the program is executed.
5.8.4 RELOCATE
Using this command the programmer can relocate a program written fora particular memory
locations to some other memory locations. The format is as follows:
SHIFT, REL (<LOLMT>)NEXT (<HILMT>) NEXT (<desired LOLMT>) EXECUTE, RESET.
Now the program has been shifted to the desired memory locations. During the relocation of a
program the jump and call addresses are also modified accordingly. This is for Vynitics' kit.
5.8.5 DELAY
A delay subroutine has been provided in the monitor. It is called by the address given by the
kit-manufacturer. To obtain the desired delay time the proper number is inserted in D-E register pair.
A
formula tocalculate delay time is given in the kit-manual. The programmer can write his own
delay subroutine. Such subroutines are given in Section 9.2.
5.9 SOFTWARE DEVELOPMENT
First of allthe problem is defined. It includes input-output specifications, processing require
ments, execution time, accuracy etc. An algorithm can be written tosolve the problem. An algorithm
isa precise statement of the procedure required for solving a problem. An algorithm can be written
in various forms. It may be expressed by means of flow charts, using English or any high-level lan
guage. The following are the stages for the development of software:
)) Problem definition
(ii) Program design
(iüi) Coding
(iv) Debugging
(v) Testing
(vi) Documentation
(vii) Maintenance
(vi) Extension and redesign
FUNDAMENTALS OF MICROPROCESSORS AND MICAOCOMPUTERS
find out which instruction contains error. Usually, a break-ppoint does not affect the timing of the
ongram, and hence it can be used to check input/output and interrupts. Most MDS and simulator
prgrams have tacilities to introduce
Asimple example ot break point break-points.
technique is given below. The program contains a loop. It is
very difficult task to crOss the loop by single step technique. Abreak point has been introduced after
h loop, which makes the testing of the
program very easy.
PROGRAM
Memory Machine Label Mnemonics Comments
Codes
Operands
Addrss
2400 06, FF MVI B, FF Get FF in register B.
2402 05 LOOP DCR B Decremernt register B.
2403 C2, 02, 24 JNZ LOOP Is conternt of B zero?
No, jump to LOOP.
2406 EF RST 5 Break point.
2407 3E, 02 MVI A, 02 Get 02 in A.
2409 32, 00, 25 STA 2500 H Store 02 in 2500 H
240C 76 HLT Stop.
At memory locations 2402-2405H there is aloop. Tocross the loop abreak point has been intro
duced at the memory location 2406 H. When the above program is executed 'E is not displayed by
the microprocessor kit; EC-85 is displayed (it is for Professional's kit). After this the key for "Single
Instruction" SI is pressed. Now the address next to the address of the instruction RST 5 i.e. 2407 H is
displayed. Nowonward the program can be tested in single step.
5.11 MODULAR PROGRAMMING
When programs become very long, they are divided into smaller programs or modules. These
smaller programs can be written, tested and debugged separately. This technique of programming
is known as modular programming.
The advantages of modular programming are :
1. It is easy to write, test and debug a module.
2. Generally the modules of common nature are prepared, which can be used at many places.
3. The programmer can divide tasks and use the previously written programs.
4. If a change is to be made, it is made in the particular module; the entire program is not
affected.
START
IS
NO
A>8
+ YES
PROGM1 START
PROGM 2
NO
A8
rEs
PROGM
ENO
STOP
Fig. 5.6. Program FlowChart for
Conditional Structure. Fig. 5.7 Program Flow
a A loop Chart for Loop
it structure. If a certain
does not go into the loop. For condition satisfied, the program
is
Structure.
nrooram PROGM. If this conditionexample, the given condition is that ifmoves in a loop,otherwise
is not satistied the A>B, execute the given
The program flow chart is shown in Fig. 5.7. computer will not execute the given program.