Unit 2
Unit 2
MEMORY ORGANISATION:
• The 8051 has a separate memory space for programs (Code) and data.
• Program memory stores the programs to be executed, while data memory stores the
data like intermediate results, variable and constants required for the execution of the
program.
The key board interfaced is a matrix keyboard. This key board is designed with a particular rows
and columns. These rows and columns are connected to the microcontroller through its ports of
the micro controller 8051. We normally use 8*8matrix key board. So only two ports of 8051 can
be easily connected to the rows andcolumns of the key board.
Whenever a key is pressed, a row and a column gets shorted through that pressed key and all the
other keys are left open. When a key is pressed only a bit in the port goes high which indicates
microcontroller that the key is pressed. By this high on
the bit key in the corresponding column is identified.
Once we are sure that one of key in the key board is pressed next our aim is to identify that
key. To do this we firstly check for particular row and then we check the corresponding column
the key board.
To check the row of the pressed key in the keyboard, one of the row is made high by making one of
bit in the output port of 8051 high . This is done until the row is found out.
Once we get the row next job is to find out the column of the pressed key. The column is
detected by contents in the input ports with the help of a counter. The content of the input port is
rotated with carry until the carry bit is set.
The contents of the counter are then compared and displayed in the display. This displayis designed
using a seven segment display and a BCD to seven segment decoder IC 7447. The BCD equivalent
number of counter is sent through output part of 8051 displays thenumber of pressed key.
These converters internally have a 3:8 analog multiplexers so that at a time eight different analog
conversion by using address lines - ADD A, ADD B, ADD C. Using these address inputs,
multichannel data acquisition system can be designed using a singleADC. The CPU may drive these
lines using output port lines in case of multichannel applications. In case of single input applications,
these may be hardwired to select the proper input.
There is unipolar analog to digital converters, i.e. they are able to convert only positive
analog input voltage to their digital equivalent. These chips do not contain any internal
sample and hold circuit. If one needs a sample and hold circuit for the conversion of fast signal
into equivalent digital quantities, it has to be externally connected at each of the analog inputs.
1.2 External Memory Interface:
8031 chip is a ROM less version of the 8051. In other words, it is exactly like any member of the 8051 family
such as the 8751 or 89C51 as far as executing the instructions and features are concerned, but it has no on-
chip ROM. Therefore, to make the 8031 execute 8051 code, it must be connected to external ROM memory
containing the program code. In this section we look at interfacing the 8031 microcontroller with external
ROM. Before we discuss this topic, one might wonder why someone would want to use the 8031 when they
could buy an 8751, 89C51, or DS5000. The reason is that all these chips have a limited amount of on-chip
ROM. Therefore, in many systems where the on-chip ROM of the 8051 is not sufficient, the use of an 8031 is
ideal since it allows the program size to be as large as 64K bytes. Although the 8031 chip itself is much cheaper
than other family members, an 8031-based system is much more expensive since the ROM containing the
program code is connected externally and requires more supporting circuitry, as we explain next. First, we
review some of the pins of the 8031/51 used in external memory interfacing.
EA pin
In 8751/89C51/DS5000-based systems, we connect the EA pin to Vcc to indicate that the program code is
stored in the microcontroller’s on-chip ROM. To indicate that the program code is stored in external ROM,
this pin must be connected to GND. This is the case for the 8051-based system. In fact, there are times when,
due to repeated burning and erasing of on-chip ROM, its UV-EPROM is no longer working. In such cases one
can also use the 8751 (or 89C51 or any 8051) as the 8031. All we have to do is to connect the EA pin to ground
and connect the chip to external ROM containing the program code.
1.3 Stepper Motor Interface
The complete board consists of transformer, control circuit, keypad and stepper motor as shown in
snap.
The circuit has inbuilt 5 V power supply so when it is connected with transformer it willgive the
supply to circuit and motor both. The 8 Key keypad is connected with circuit through which user can
give the command to control stepper motor. The control circuitincludes micro controller 89C51,
indicating LEDs, and current driver chip ULN2003A.One can program the controller to control the
operation of stepper motor. He can give different commands through keypad like, run clockwise, run
anticlockwise, increase/decrease RPM, increase/decrease revolutions, stop motor, change the mode,
etc.
Unipolar stepper motor: - unipolar stepper motor has four coils. One end of each coil is tied together
and it gives common terminal which is always connected with positive terminal of supply. The other
ends of each coil are given for interface.
By means of controlling a stepper motor operation we can
1. Increase or decrease the RPM (speed) of it
2. Increase or decrease number of revolutions of it
3. Change its direction means rotate it clockwise or anticlockwise
To vary the RPM of motor we have to vary the PRF (Pulse Repetition Frequency). Number
of applied pulses will vary number of rotations and last to changedirection we have to change pulse
sequence.
So all these three things just depend on applied pulses. Now there are three different modes to rotate
this motor
1. Single coil excitation
2. Double coil excitation
3. Half step excitation
• cellphones
• electric vehicles
• Arduino-based devices
Arduino is an open source platform with a microcontroller that processes simple inputs, such
as temperature or pressure, and turns them into outputs. These devices have a basic embedded
OS that acts like a boot loader and a command interpreter.
An example of an Arduino-based device is a remote control car. The Arduino reads inputs from
the car's controller and sends output information and commands to other components, such as
the brakes.
Advantages Embedded OS
The advantages of embedded operating system are as follows −
– Portable
– Much faster than other operating systems
– Less Hardware requirement
– Highly Predictable
Disadvantages
The disadvantages of embedded operating system are as follows −
– Less optimization
– High modification is required
– Customization is time taking process
1. Preemptive Multitasking:
Preemptive multitasking is a task that a computer operating system is given. It determines how
much time one job spends on the operating system before assigning another process to use it.
The operating system is referred to as preemptive because it controls the entire operation.
Preemptive multitasking is used in desktop operating systems. Unix was the first operating
system to implement this multitasking technique. The first versions of Windows to implement
preemptive multitasking was Windows NT and Windows 95. In OS X, proactive multitasking
was added to the Macintosh. This operating system notifies the programs when another
application is ready to take over the CPU.
2. Cooperative Multitasking:
A cooperative multitasking operating system is referred to as 'Non-Preemptive Multitasking.'
The basic goal of cooperative multitasking is to complete the current work while allowing
another process to execute. taskYIELD() is used to complete this task. Context-switch is called
when the taskYIELD() function is called.
Cooperative multitasking operating system was utilized by Windows and macOS. When a
Windows program receives a message, It will do some quick work before handing over the
CPU to the operating system until another message arrives. It worked perfectly as long as all
of the programs were bug-free and designed with other programs in mind.
3. True Multitasking:
A true multitasking operating system is the ability to execute and process many tasks
simultaneously without delay, rather than switching work from one processor to another. A true
Multitasking operating system has the ability to conduct several tasks simultaneously while
underlying the H/W or S/W.
Advantages of Multitasking Operating System
The following are some of the advantages of a multitasking operating system:
S.
Type Description
No.
All jobs are given a defined amount of time, so they don't have to wait
1 Time Shareable
for the CPU.
Multitasking operating systems have the best virtual memory system.
Any program does not require a long wait time to perform its tasks
2 Virtual Memory
because of virtual memory; if this problem arises, those applications are
shifted to virtual memory.
Multitasking operating systems have well-defined memory management
3 Secured Memory since they do not provide any types of permissions for undecided apps to
consume memory.
Multiple users are better satisfied with multitasking operating systems
4 Good Reliability because they provide more flexibility. Every user can easily run single or
numerous programs on a multitasking operating system.
This operating system is better adapted to support several users at once,
Manage Several
5 and multiple apps can run simultaneously without slowing down the
Users
system.
Optimize A multitasking operating system may manage the resources of several
6 Computer computers, including RAM, input/output devices, CPU, hard disc, and so
Resources on.
Background processes can operate more efficiently under a multitasking
Background operating system. Most users are unaware of these background processes,
7
Processing although they aid the smooth operation of other programs such as
firewalls, antivirus software, and others.
Users can run multiple programs at once, including an internet browser,
Use Multiple
8 a code editor, Microsoft Word, Microsoft Excel, PowerPoint, games, and
Programs
other utilities.
Disadvantages of Multitasking Operating System
The following are some of the disadvantages of multitasking operating system:
S.
Type Description
No.
Because of the poor speed of its processors, the system may run applications
Processor slowly, and their reaction time may increase when processing many
1
Boundation programs. More computing power is necessary to solve the processing
foundation challenge.
In a multitasking operating system, the CPU generates more heat since
2 CPU Heat up
multiple processors are engaged at the same time to execute any task.
The computer's performance may suffer as a result of many programs
running at the same time, as the main memory becomes overloaded when
Memory multiple programs are loaded. Reaction time grows since the CPU is unable
3
Boundation to give distinct times for each program. The usage of low-capacity RAM is
the primary cause of this problem. As a result, the RAM capacity can be
increased to meet the requirements.
Conclusion
• Multitasking is the process of performing multiple tasks simultaneously.
• In a multitasking operating system, the CPU switches between many tasks to
complete them.
• Isolation and memory protection is provided by multitasking operating systems.
• A multitasking operating system utilizes the concept of many processors.
• A multitasking operating system can run multiple tasks at the same time.
• In a multitasking operating system, context-switching and time-sharing are used.
• CPU idle time is significantly decreased in the multitasking operating system.
• 1 CPU is required in a multitasking operating system.
Types of RTOS
Three types of RTOS systems are:
1. Hard Real Time
In Hard RTOS, the deadline is handled very strictly which means that given task must start
executing on specified scheduled time, and must be completed within the assigned time
duration.
Example: Medical critical care system, Aircraft systems, etc.
2. Firm Real time
These type of RTOS also need to follow the deadlines. However, missing a deadline may not
have big impact but could cause undesired affects, like a huge reduction in quality of a product.
Example: Various types of Multimedia applications.
3. Soft Real Time
Soft Real time RTOS, accepts some delays by the Operating system. In this type of RTOS,
there is a deadline assigned for a specific job, but a delay for a small amount of time is
acceptable. So, deadlines are handled softly by this type of RTOS.
Example: Online Transaction system and Livestock price quotation System.
Features of RTOS
Here are important features of RTOS:
• Occupy very less memory
• Consume fewer resources
• Response times are highly predictable
• Unpredictable environment
• The Kernel saves the state of the interrupted task ad then determines which task it
should run next.
• The Kernel restores the state of the task and passes control of the CPU for that task.