0% found this document useful (0 votes)
53 views18 pages

Embedded (Practical)

The document discusses the ATmega16 microcontroller and provides details about its pin diagram. It has 40 pins and is based on an 8-bit enhanced RISC architecture. The pin diagram lists the functions of each pin such as inputs, outputs, power, clock, and interfaces. It also compares microprocessors and microcontrollers, noting that microcontrollers have memory, I/O, and other components internally whereas microprocessors require external components, making microcontroller systems more compact and lower cost.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views18 pages

Embedded (Practical)

The document discusses the ATmega16 microcontroller and provides details about its pin diagram. It has 40 pins and is based on an 8-bit enhanced RISC architecture. The pin diagram lists the functions of each pin such as inputs, outputs, power, clock, and interfaces. It also compares microprocessors and microcontrollers, noting that microcontrollers have memory, I/O, and other components internally whereas microprocessors require external components, making microcontroller systems more compact and lower cost.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Q1) explain the pin diagram of atmega16 microcontroller?

Ans) ATmega16 is an 8-bit high performance microcontroller from the


Atmel’s Mega AVR family. Atmega16 is a 40 pin microcontroller based on
enhanced RISC (Reduced Instruction Set Computing) architecture with 131
powerful instructions. It has a 16 KB programmable flash memory, static
RAM of 1 KB and EEPROM of 512 Bytes. The endurance cycle of flash
memory and EEPROM is 10,000 and 100,000, respectively. Most of the
instructions execute in one machine cycle.
ATmega16 Pin description
I/O , T0 ( Timer0 External Counter Input) ,XCK : USART External
PIN1
Clock I/O

PIN2 I/O, T1 (Timer1 External Counter Input)

I/O, AIN0: Analog Comparator Positive Input , INT2: External


PIN3
Interrupt 2 Input

I/O, AIN1: Analog Comparator Negative Input, OC0 : Timer0 Output


PIN4
Compare Match Output

PIN9 Reset Pin, Active Low Reset

PIN10 VCC=+5V

PIN11 GND

PIN12 XTAL2

PIN13 XTAL1

PIN14 (RXD) ,I/O PIN 0,USART Serial Communication Interface

PIN15 (TXD) ,I/O Pin 1,USART Serial Communication Interface

PIN16 (INT0),I/O Pin 2, External Interrupt INT0

PIN17 (INT1),I/O Pin 3, External Interrupt INT1

PIN18 (OC1B),I/O Pin 4, PWM Channel Outputs

PIN19 (OC1A),I/O Pin 5, PWM Channel Outputs

PIN20 (ICP), I/O Pin 6, Timer/Counter1 Input Capture Pin

PIN21 (OC2),I/O Pin 7,Timer/Counter2 Output Compare Match Output


PIN22 (SCL),I/O Pin 0,TWI Interface

PIN23 (SDA),I/O Pin 1,TWI Interface

PIN24-27 JTAG INTERFACE

PIN28 : (TOSC1),I/O Pin 6,Timer Oscillator Pin 1

PIN29 : (TOSC2),I/O Pin 7,Timer Oscillator Pin 2

PIN30 : AVCC (for ADC)

PIN31 : GND (for ADC)

PIN33 –
PAx: I/O,ADCx (Where x is 7 – 0)
PIN40

Microprocessor Microcontroller

Microprocessor is the heart of Computer Micro Controller is the heart of an


system. embedded system.
It is only a processor, so memory and I/O Micro Controller has a processor
components need to be connected along with internal memory and
externally I/O components.
Memory and I/O are already
Memory and I/O has to be connected
present, and the internal circuit is
externally, so the circuit becomes large.
small.
You can use it in compact
You can’t use it in compact systems
systems.
Cost of the entire system is high Cost of the entire system is low
Due to external components, the total power As external components are low,
consumption is high. Therefore, it is not total power consumption is less.
ideal for the devices running on stored So it can be used with devices
power like batteries. running on stored power like
batteries.
Most of the microprocessors do not have Most of the microcontrollers offer
power saving features. power-saving mode.
It is used mainly in a washing
It is mainly used in personal computers. machine, MP3 players, and
embedded systems.
Microprocessor has a smaller number of Microcontroller has more register.
registers, so more operations are memory- Hence the programs are easier to
based. write.
Microprocessors are based on Von Micro controllers are based on
Neumann model Harvard architecture
It is a byproduct of the
It is a central processing unit on a single development of microprocessors
silicon-based integrated chip. with a CPU along with other
peripherals.
It has a CPU along with RAM,
It has no RAM, ROM, Input-Output units,
ROM, and other peripherals
timers, and other peripherals on the chip.
embedded on a single chip.
It uses an external bus to interface to RAM,
It uses an internal controlling bus.
ROM, and other peripherals.
Microprocessor-based systems can run at a Microcontroller based systems run
very high speed because of the technology up to 200MHz or more depending
involved. on the architecture.
It’s used for general purpose
It’s used for application-specific
applications that allow you to handle loads
systems.
of data.
It’s simple and inexpensive with
It’s complex and expensive, with a large
less number of instructions to
number of instructions to process.
process.
Microcontroller
A Microcontroller is a small and low-cost microcomputer, which is designed
to perform the specific tasks of embedded systems like displaying microwave
information, receiving remote signals etc.
The general microcontroller consists of the processor, the memory (RAM,
ROM, EPROM), Serial ports, peripherals (timers, counters) etc.
Types of Microcontrollers
Microcontrollers are divided into various categories based on memory,
architecture, bits and instruction sets. Following is the list of their types −
• Bit – Based on bit configuration, the microcontroller is further divided
into three categories.
o 8-bit microcontroller − This type of the microcontroller is used to
execute arithmetic and logical operations like addition, subtraction,
multiplication division, etc. For example, Intel 8031 and 8051 are an
8-bit microcontroller.

o 16-bit microcontrollers − This type of the microcontroller is used


to perform arithmetic and logical operations where higher accuracy
and performance is required. Forexample, Intel 8096 is a 16-bit
microcontroller.

o 32-bit microcontrollers − This type of the microcontroller is


generally used in automatically controlled appliances like automatic
operational machines, medical appliances, etc.

Ans 3)
Interrupt is the method of creating a temporary halt during program execution
and allows peripheral devices to access the microprocessor. The
microprocessor responds to that interrupt with an ISR (Interrupt Service
Routine), which is a short program to instruct the microprocessor on how to
handle the interrupt.
Hardware Interrupts
Hardware interrupt is caused by any peripheral device by sending a signal
through a specified pin to the microprocessor.
The 8086 has two hardware interrupt pins, i.e. NMI and INTR. NMI is a non-
maskable interrupt and INTR is a maskable interrupt having lower priority.
One more interrupt pin associated is INTA called interrupt acknowledge.
Software Interrupts
Some instructions are inserted at the desired position into the program to create
interrupts. These interrupt instructions can be used to test the working of
various interrupt handlers.

Ans 4)
Direct Memory Access (DMA):
DMA Controller is a hardware device that allows I/O devices to directly
access memory with less participation of the processor. DMA controller
needs the same old circuits of an interface to communicate with the CPU and
Input/Output devices.
DMA CYCLE DIAGRAM in Comp. Architecture

Ans 5)

Embedded C is most popular programming language in software field for developing


electronic gadgets. Each processor used in electronic system is associated with embedded
software.

Embedded C programming plays a key role in performing specific function by the


processor. In day-to-day life we used many electronic devices such as mobile phone,
washing machine, digital camera, etc. These all device working is based on
microcontroller that are programmed by embedded C.

In embedded system programming C code is preferred over other language. Due to the
following reasons:

o Easy to understand
o High Reliability
o Portability
o Scalability
The If Statements
This type of statement would enable a programmer to choose various instruction sets on
the basis of the available condition. The instruction sets will only get executed when the
evaluation of the condition turns out to be true. In case the evaluation of the condition is
false, there will be an execution of a different instruction set. These are also known
as decision control statements. These are of the following types:

• Simple else or Null else


• Else if ladder
• Nested if
• If… else

2. The Switch Statements


The C language offers its users with a selection statement in various ways in
case a program becomes difficult to read with an increased number of
conditions. A switch statement is a multi-way type of selection statement that
would resolve this issue. The switch declaration comes into play when more
than three alternatives (conditions) exist in a program. This command then
switches between all the available blocks on the basis of the expression value.
3. The Conditional Operator Statements
The C language also comes with a very unusual operator for its programmers – the
conditional operator.

The syntax of the conditional operator statements is as follows:

(condition 1)? expression_1: expression_2

Here, the execution of the expression_1 will only occur when the given condition is valid.
In case this statement is incorrect, then the execution of the expression_2 will occur .

4. The Loop Statements


A programmer in C might want to repeat any set of instructions or certain statements in
the program to meet the necessary requirements. In such instances, it becomes difficult to
rewrite and repeat everything. And that is exactly where we would like to create loops
using the looping declarations. Loop control statements help in such types of situations in
C. We have the following types of loops in C:

• Do While Loop
• While Loop
• For Loop

Input Configuration
If any pin of this port is configured as an input, then it acts as if it “floats”, i.e. the input has
unlimited input resistance and in-determined potential.
Output Configuration
When the pin is configured as an output, then it acts as an “open drain”. By applying logic 0 to a
port bit, the appropriate pin will be connected to ground (0V), and applying logic 1, the external
output will keep on “floating”.
In order to apply logic 1 (5V) on this output pin, it is necessary to build an external pullup
resistor.
Port 1
P1 is a true I/O port as it doesn’t have any alternative functions as in P0, but this port can be
configured as general I/O only. It has a built-in pull-up resistor and is completely compatible
with TTL circuits.
Port 2
P2 is similar to P0 when the external memory is used. Pins of this port occupy addresses
intended for the external memory chip. This port can be used for higher address byte with
addresses A8-A15. When no memory is added then this port can be used as a general
input/output port similar to Port 1.
Port 3
In this port, functions are similar to other ports except that the logic 1 must be applied to
appropriate bit of the P3 register.

Ans 6)
Embedded Sensor

An embedded sensor network is a network of embedded computers placed in the


physical world that interacts with the environment. These embedded computers,
or sensor nodes, are often physically small, relatively inexpensive computers, each
with some set of sensors or actuators. These sensor nodes are deployed in situ,
physically placed in the environment near the objects they are sensing. Sensor nodes
are networked, allowing them to communicate and cooperate with each other to
monitor the environment and (possibly) effect changes to it. Current sensor networks
are usually stationary, although sensors may be attached to moving objects or may
even be capable of independent movement. These characteristics: being embedded,
and being capable of sensing, actuation, and the ability to communicate, define the
field of sensor networking and differentiate it from remote sensing, mobile
computing with laptop computers, and traditional centralized sensing systems.

Keypad Programming

Keypad is an analog switching device which is generally available in matrix


structure. It is used in many embedded system application for allowing the user to
perform a necessary task.

matrix keypad is consists of an arrangement of switches connected in matrix


format in rows and columns. The rows and columns are connected with a
microcontroller such that the rows of switches are connected to one pin and the
columns of switches are connected to another pin of a microcontroller.

LCD
The principle behind the LCDs is that when an electrical current is applied to the
liquid crystal molecule, the molecule tends to untwist. This causes the angle of light
which is passing through the molecule of the polarized glass and also causes a
change in the angle of the top polarizing filter. As a result, a little light is allowed to
pass the polarized glass through a particular area of the LCD.

Thus that particular area will become dark compared to others. The LCD works on
the principle of blocking light. While constructing the LCDs, a reflected mirror is
arranged at the back. An electrode plane is made of indium-tin-oxide which is kept
on top and a polarized glass with a polarizing film is also added on the bottom of the
device. The complete region of the LCD has to be enclosed by a common electrode
and above it should be the liquid crystal matter.

Ans 7)

The Instruction Cycle –


Each phase of Instruction Cycle can be decomposed into a sequence of elementary
micro-operations. In the above examples, there is one sequence each for the Fetch,
Indirect, Execute and Interrupt Cycles.
The Indirect Cycle is always followed by the Execute Cycle. The Interrupt Cycle is
always followed by the Fetch Cycle. For both fetch and execute cycles, the next cycle
depends on the state of the system.

We assumed a new 2-bit register called Instruction Cycle Code (ICC). The ICC
designates the state of processor in terms of which portion of the cycle it is in:-
00 : Fetch Cycle
01 : Indirect Cycle
10 : Execute Cycle
11 : Interrupt Cycle

Machine Cycle
The machine cycle is the most basic operation that a computer performs, and in
order to complete menial tasks such as showing a single character on the screen,
the CPU has to perform multiple cycles. The computer does this from the moment
it boots up until it shuts down.

The steps of a machine cycle are:

• Fetch – The control unit requests instructions from the main memory that is stored at a
memory’s location as indicated by the program counter (also known as the instruction
counter).
• Decode – Received instructions are decoded in the instruction register. This involves
breaking the operand field into its components based on the instruction’s operation code
(opcode).
• Execute – This involves the instruction’s opcode as it specifies the CPU operation required.
The program counter indicates the instruction sequence for computer. These instructions
are arranged into the instructions register and as each are executed, it increments the
program counter so that the next instruction is stored in memory. Appropriate circuitry is
then activated to perform the requested task. As soon as instructions have been executed,
it restarts the machine cycle that begins the fetch step

T-STATES

T-state is defined as one subdivision of operation performed in one clock period. These
subdivisions are internal states synchronized with the system clock, and each T-state is
precisely equal to one clock period.

Original assembly
Opcode Operand Description
language

INP INP Input value and store in the accumulator


STA 1C STA 1C Store the number at memory address 1C
INP INP Input value and store in the accumulator

ADD 1C ADD 1C
Add this number to the number stored at
memory address 1C
OUT OUT Output the result
HLT HLT Stop the program

A low-level language, often known as a computer's native language, is a sort of programming


language. It is very close to writing actual machine instructions, and it deals with a computer's hardware
components and constraints. It works to control a computer's operational semantics and provides little
or no abstraction of programming ideas. In contrast to high-level language that used for developing
software, low-level code is not human-readable, and it is often cryptic. Assembly language and machine
language are two examples of low-level programming languages.

A high-level language is any programming language that enables development of a


program in a much more user-friendly programming context and is generally independent
of the computer's hardware architecture.

A high-level language has a higher level of abstraction from the computer, and focuses
more on the programming logic rather than the underlying hardware components such as
memory addressing and registers utilization.
The machine-level language is a language that consists of a set of instructions that
are in the binary form 0 or 1. As we know that computers can understand only machine
instructions, which are in binary digits, i.e., 0 and 1, so the instructions given to the computer
can be only in binary codes.

Ans 8)

Von-Neumann computer architecture:


Von-Neumann computer architecture design was proposed in 1945.It was later known
as Von-Neumann architecture.
Historically there have been 2 types of Computers:
1. Fixed Program Computers – Their function is very specific and they couldn’t be
reprogrammed, e.g. Calculators.
2. Stored Program Computers – These can be programmed to carry out many
different tasks, applications are stored on them, hence the name.
Modern computers are based on a stored-program concept introduced by John Von
Neumann. In this stored-program concept, programs and data are stored in a separate
storage unit called memories and are treated the same. This novel idea meant that a
computer built with this architecture would be much easier to reprogram .

It is also known as ISA (Instruction set architecture) computer and is having three basic
units:
1. The Central Processing Unit (CPU)
2. The Main Memory Unit
3. The Input/Output Device Let’s consider them in detail.

Harvard Architecture is the computer architecture that contains separate


storage and separate buses (signal path) for instruction and data. It was
basically developed to overcome the bottleneck of Von Neumann’s
Architecture. The main advantage of having separate buses for instruction and
data is that the CPU can access instructions and read/write data at the same
time.
Structure of Harvard Architecture:

Pipelining is a process of arrangement of hardware elements of the CPU such that


its overall performance is increased. Simultaneous execution of more than one
instruction takes place in a pipelined processor.

Design of a basic pipeline


• In a pipelined processor, a pipeline has two ends, the input end and the output end.
Between these ends, there are multiple stages/segments such that the output of
one stage is connected to the input of the next stage and each stage performs a
specific operation.
• Interface registers are used to hold the intermediate output between two stages.
These interface registers are also called latch or buffer.
• All the stages in the pipeline along with the interface registers are controlled by a
common clock.

S.NO Paging Segmentation

In paging, the program is divided into In segmentation, the program is divided


1.
fixed or mounted size pages. into variable size sections.

For the paging operating system is For segmentation compiler is


2.
accountable. accountable.

Page size is determined by Here, the section size is given by the


3.
hardware. user.

It is faster in comparison to
4. Segmentation is slow.
segmentation.

Paging could result in internal Segmentation could result in external


5.
fragmentation. fragmentation.

In paging, the logical address is split Here, the logical address is split into
6.
into a page number and page offset. section number and section offset.

Paging comprises a page table that While segmentation also comprises the
7. encloses the base address of every segment table which encloses segment
page. number and segment offset.

The page table is employed to keep Section Table maintains the section
8.
up the page data. data.

In segmentation, the operating system


In paging, the operating system must
9. maintains a list of holes in the main
maintain a free frame list.
memory.

10. Paging is invisible to the user. Segmentation is visible to the user.

In paging, the processor needs the In segmentation, the processor uses


11.
page number, and offset to calculate segment number, and offset to calculate
S.NO Paging Segmentation

the absolute address. the full address.

It is hard to allow sharing of Facilitates sharing of procedures


12.
procedures between processes. between the processes.

In paging, a programmer cannot


13 It can efficiently handle data structures.
efficiently handle data structure.

Easy to apply for protection in


14. This protection is hard to apply.
segmentation.

The size of the page needs always There is no constraint on the size of
15.
be equal to the size of frames. segments.

A page is referred to as a physical A segment is referred to as a logical unit


16.
unit of information. of information.

Paging results in a less efficient Segmentation results in a more efficient


17.
system. system.

Parallel Processing
Parallel processing can be described as a class of techniques which enables the system to
achieve simultaneous data-processing tasks to increase the computational speed of a computer
system.

A parallel processing system can carry out simultaneous data-processing to achieve faster
execution time. For instance, while an instruction is being processed in the ALU component of
the CPU, the next instruction can be read from memory.

The primary purpose of parallel processing is to enhance the computer processing capability
and increase its throughput, i.e. the amount of processing that can be accomplished during a
given interval of time.
A parallel processing system can be achieved by having a multiplicity of functional units that
perform identical or different operations simultaneously. The data can be distributed among
various multiple functional units.

You might also like