0% found this document useful (0 votes)
14 views40 pages

Ece541 Microprocessor and Embedded System Design

The document provides an overview of microprocessor and embedded system design, focusing on the Intel 8051/8031 and Motorola M6811 microcontrollers, including their architecture, instruction sets, and applications. It details the components and characteristics of embedded systems, such as real-time operation and low power consumption, along with various interfacing techniques and memory organization. Additionally, it covers programming aspects, including assembly language and the use of special function registers for controlling peripherals.

Uploaded by

jafarabdulganiy
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)
14 views40 pages

Ece541 Microprocessor and Embedded System Design

The document provides an overview of microprocessor and embedded system design, focusing on the Intel 8051/8031 and Motorola M6811 microcontrollers, including their architecture, instruction sets, and applications. It details the components and characteristics of embedded systems, such as real-time operation and low power consumption, along with various interfacing techniques and memory organization. Additionally, it covers programming aspects, including assembly language and the use of special function registers for controlling peripherals.

Uploaded by

jafarabdulganiy
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/ 40

ECE541 MICROPROCESSOR AND EMBEDDED SYSTEM DESIGN

Introduction to embedded system, components, characteristics and applications. Intel 8051/8031


Micro-controller: Features of the 8051/8031 family, block diagram and definitions of the pin of
the 8051, I/O port structure, memory organization: general purpose RAM, bit addressable RAM,
register bank, special function registers, external memory, memory space mapping and decoding,
bus control signals timing, a typical 8051 micro-controller-based system. Instruction Set and
Assembly Language Programming: Addressing modes, the 8051instruction set and typical
examples, assembler operation, assembly language format, assembler directives, operation of
assemblers and linkers, programming examples. On-chip Peripheral Devices: I/O ports,
operations and uses of port 0, port 1, port 2, port 3, timers: their operations, programming, and
applications, serial port: operations and programming, typical applications, serial port interrupt.
Interfacing to external memory, keypad, seven-segment LED display, ADC and DAC chips, and
input / output port expansion, description and uses of hardware development tools.
MOTOROLA M6811 Micro-controller: Features of the M6811 family, block diagram and
definitions of the pin of the M6811, I/O port structure, memory organisation: general purpose
RAM, bit addressable RAM, register bank, special function registers, external memory, memory
space mapping and decoding, bus control signals timing. Instruction Set and Assembly Language
Programming. On-chip peripheral devices and I/O interfacing. Introduction to PIC
microcontroller: general architecture, applications and selection of microcontroller, advantages,
low-end, and high performance PIC. Specific PIC microcontrollers: Features, architecture, block
diagram, pin configuration, on-chip memory, and peripheral. Instruction set and Assembly
language programming. Serial I/O interfacing: I2C, and SPI interfacing and programming.
Memory interfacing: external memory interfacing, EEPROM and Flash memory interfacing.
Design exercises using development systems.
ECE541 MICROPROCESSOR AND EMBEDDED SYSTEM DESIGN
Embedded Systems
Embedded systems are specialized computing systems designed to perform specific dedicated
functions within a larger mechanical or electrical system. They are built around a microcontroller
or microprocessor and are programmed to execute predetermined tasks, often in real-time. These
systems are integrated into various devices and appliances to control, monitor, or manage their
functionalities.
Components of an Embedded System
 Processor/CPU: This is the core computing unit that executes instructions and processes
data. It could be a microcontroller (like Arduino, PIC, etc.) or a microprocessor (such as
ARM, Intel, etc.).
 Memory: It includes RAM (volatile memory) for temporary data storage and ROM/Flash
memory (non-volatile) for storing the program code and essential data.
 Input Devices: Sensors, interfaces (like buttons, touchscreens, etc.), and communication
modules (Wi-Fi, Bluetooth, etc.) that collect data or receive commands.
 Output Devices: Displays, actuators, motors, LEDs, speakers, etc., used to showcase
information or trigger actions based on processed data.
 Real-time Operating System (RTOS): Some embedded systems utilize specialized
operating systems designed for real-time applications to manage tasks and resources
efficiently.

Characteristics of Embedded Systems


 Real-time Operation: Many embedded systems need to respond within strict time
constraints, especially in applications like automotive systems, industrial control, medical
devices, etc.
 Low Power Consumption: Efficiency in power usage is crucial, particularly for devices
running on batteries or requiring continuous operation without overheating.
 Specific Functionality: These systems are tailored for specific tasks and are optimized for
those functions, unlike general-purpose computers.
 Compact Size: Embedded systems are designed to fit within the constraints of the host
device or system, often requiring small form factors and minimal space.

Applications of Embedded Systems


 Consumer Electronics: Smartphones, digital cameras, home appliances (like smart TVs,
washing machines), wearable devices, etc.
 Automotive Industry: Embedded systems are integral in vehicle control systems,
navigation, entertainment systems, and safety features like airbag control, ABS, etc.
 Industrial Automation: Used in control systems for machinery, robotics, process control,
and monitoring equipment in factories.
 Medical Devices: Embedded systems power medical equipment such as heart rate
monitors, MRI machines, pacemakers, insulin pumps, etc.
 Aerospace and Defense: In avionics systems, missile guidance, surveillance equipment,
and more.
 Networking and Communications: Routers, switches, modems, and various network
appliances.
NOTE: Embedded systems are fundamental to modern technology, contributing significantly
to the functionality and efficiency of numerous devices and systems across various industries.
Their diversity and adaptability continue to drive innovation in countless fields.

Intel 8051 and 8031 Microcontrollers


The Intel 8051 and 8031 are 8-bit microcontrollers developed by Intel in the 1980s and
widely used in embedded systems due to their versatility, reliability, and ease of use. They
share many similarities, with the primary difference being the amount of on-chip memory
they possess.
Key Features of Intel 8031 and 8051 Microcontrollers
8-bit CPU: The microcontrollers feature an 8-bit CPU architecture, allowing them to process 8
bits of data at a time.
On-chip Memory
 8051: It typically has 128 bytes of RAM, 4 KB of ROM (EPROM or Flash memory), and
4 parallel I/O ports.
 8031: It's essentially an 8051 variant with less on-chip RAM (only 128 bytes) and lacks
the on-chip ROM. Instead, it requires external ROM.
I/O Ports: Both microcontrollers include multiple I/O ports that can be used to interface with
external devices, sensors, or other systems.
Timers/Counters: They have built-in timers/counters for various time-related functions and
tasks.
Serial Communication: Both include a UART (Universal Asynchronous Receiver-Transmitter)
for serial communication, allowing them to communicate with other devices or systems serially.
Interrupts: The microcontrollers support interrupts to handle time-critical tasks and events
efficiently.
Clock Speed: The typical clock speed for these microcontrollers ranges from a few MHz to tens
of MHz.

INTERNAL ACHITECTURE OF INTEL 8031 and 8051 MICROCONTROLLERS


Architecture of Intel 8051 and 8031 Microcontrollers
The architecture of the 8051/8031 microcontrollers consists of various functional blocks:
 CPU Core: It includes an ALU (Arithmetic Logic Unit), various registers (like
accumulator, data pointer, etc.), and an instruction decoder.
 Memory: RAM for data storage, ROM (external or on-chip) for program storage, and
special function registers (SFRs) for controlling peripherals.
 I/O Ports: Multiple ports (typically 4 in 8051) for interfacing with external devices.
 Timers/Counters: Built-in timers/counters for timing-related operations.
Applications Intel 8051 and 8031
 These microcontrollers find applications in various fields, including but not limited to:
 Industrial Automation: Used in controlling and monitoring systems in factories and
industries.
 Automotive Electronics: Embedded in vehicle control systems, automotive sensors, etc.
 Consumer Electronics: Found in devices such as remote controls, toys, appliances, etc.
 Embedded Systems: Used in numerous embedded applications due to their versatility and
reliability.
 Programming these microcontrollers can be done in assembly language or using higher-
level languages like C. Assembly language provides direct control over the hardware,
while C offers a more structured and readable approach.

8051 PIN CONFIGURATION


Pin Definitions of 8051
Understanding the pin definitions and I/O port structure is crucial for effectively interfacing the
8051/8031 microcontroller with external devices, sensors, and circuits, enabling the
microcontroller to perform various tasks in embedded systems.
VCC and GND: Power supply pins.
ALE (Address Latch Enable): Used to latch the address into external latch for interfacing with
the external memory.
PSEN (Program Store Enable): Activated to read from external program memory during fetch
cycles.
EA (External Access): Determines the source of code. When grounded, uses external ROM.
When high, uses internal ROM.
Port 0 (P0): 8-bit bidirectional I/O port.
Port 1 (P1): 8-bit bidirectional I/O port.
Port 2 (P2): 8-bit bidirectional I/O port with special features like high-speed I/O and external
interrupt.
Port 3 (P3): 8-bit bidirectional I/O port with special features like high-speed I/O, two external
interrupts, and serial transmit and receive.
RST (Reset): Active low pin used to reset the microcontroller.
XTAL1 and XTAL2: Crystal oscillator pins for providing clock input to the microcontroller.
I/O Port Structure:
Each port in the 8051/8031 family consists of 8 pins (P0.0 to P0.7, P1.0 to P1.7, P2.0 to P2.7,
P3.0 to P3.7). These ports are bidirectional and can be used for both input and output operations.
8051/8031 microcontrollers feature Special Function Registers (SFRs) that control the I/O ports.
These SFRs allow configuration and control of the ports for specific functionalities such as input,
output, or alternate functions.
Memory organization of the Intel 8051
The memory organization of the Intel 8051 microcontroller is an essential aspect defining how
the memory is arranged and accessed within the device. The 8051 has a Harvard architecture,
which means it separates program memory and data memory.
The Memory Organization includes:
i. Code Memory (Program Memory):
ROM (Read-Only Memory): The 8051 typically contains 4 KB of ROM. This ROM usually
stores the program code permanently, and its contents cannot be changed during runtime. Some
variations might use EPROM (Erasable Programmable Read-Only Memory) or Flash memory.
ii. Data Memory:
RAM (Random Access Memory): The 8051 usually includes 128 bytes of RAM. This memory is
used for storing data and variables during program execution. It is volatile, meaning its contents
are lost when power is turned off.
iii. Special Function Registers (SFRs):
The 8051 has a set of special memory-mapped registers that control the functioning of various
peripherals and hardware features, such as I/O ports, timers/counters, interrupts, serial
communication, etc. These SFRs are in a specific memory address range and allow interaction
with the microcontroller's peripherals.

Addressing in 8051
16-bit Address Bus: The 8051 uses a 16-bit address bus, which allows it to address up to 64 KB
of memory (2^16 = 65,536 bytes).
Banked Memory: The 8051 employs banked memory for accessing various memory spaces. It
divides the memory into multiple banks, each accessible via different addressing modes.
Memory Map
The 128 bytes of RAM inside the 8051 are assigned the address 00 to 7FH. They can be accessed
directly as memory locations and are divided into three different groups as follows:
 32 bytes from 00H to 1FH locations are set aside for register banks and the stack.
 16 bytes from 20H to 2FH locations are set aside for bit-addressable read/write memory.
 80 bytes from 30H to 7FH locations are used for read and write storage; it is called as
scratch pad. These 80 locations RAM are widely used for the purpose of storing data and
parameters by 8051 programmers.
Register Banks in 8051
A total of 32 bytes of RAM are set aside for the register banks and the stack. These 32 bytes are
divided into four register banks in which each bank has 8 registers, R0–R7. RAM locations from
0 to 7 are set aside for bank 0 of R0–R7 where R0 is RAM location 0, R1 is RAM location 1, R2
is location 2, and so on, until the memory location 7, which belongs to R7 of bank 0.
The second bank of registers R0–R7 starts at RAM location 08 and goes to locations OFH. The
third bank of R0–R7 starts at memory location 10H and goes to location to 17H. Finally, RAM
locations 18H to 1FH are set aside for the fourth bank of R0–R7.
EXERCISE
i. If RAM locations 00–1F are set aside for the four registers banks, which register bank of
R0–R7 do we have access to when the 8051 is powered up? The answer is register bank 0; that
is, RAM locations from 0 to 7 are accessed with the names R0 to R7 when programming the
8051. Because it is much easier to refer these RAM locations by names such as R0 to R7, rather
than by their memory locations.
How to Switch Register Banks
Register bank 0 is the default when the 8051 is powered up. We can switch to the other banks
using PSW register. D4 and D3 bits of the PSW are used to select the desired register bank, since
they can be accessed by the bit addressable instructions SETB and CLR. For example, "SETB
PSW.3" will set PSW.3 = 1 and select the bank register 1.
RS1 RS2 Bank Selected
0 0 Bank0
0 1 Bank1
1 0 Bank2
1 1 Bank3

These 32 bytes are divided into 4 banks of registers in which each bank has 8 registers, R0-R7

RAM location from 0 to 7 are set aside for bank 0 of R0-R7 where R0 is RAM location 0, R1 is
RAM location 1, R2 is RAM location 2, and so on, until memory location 7 which belongs to R7
of bank 0
It is much easier to refer to these RAM locations with names such as R0, R1, and so on, than by
their memory locations
Register bank 0 is the default when 8051 is powered up.
We can switch to other banks by using the PSW register.
Bits D4 and D3 of the PSW (PROGRAM STATUS WORD) are used to select the desired
register bank.
Use the bit-addressable instructions SETB and CLR to access PSW.4 and PSW.3
Some of the examples illustrating the use of banks are shown below:

MOV R0, #99H ; load R0 with 99H


MOV R1, #85H ; load R1 with 85H
MOV 00, #99H ; RAM location 00H has 99H
MOV 01, #85H ; RAM location 01H has 85H
SETB PSW.4 ; select bank 2
MOV R0, #99H ; RAM location 10H has 99H
Stack and its Operations
Stack in the 8051
The stack is a section of a RAM used by the CPU to store information such as data or memory
address on temporary basis. The CPU needs this storage area considering limited number of
registers.
How Stacks are Accessed
As the stack is a section of a RAM, there are registers inside the CPU to point to it. The register
used to access the stack is known as the stack pointer register. The stack pointer in the 8051 is 8-
bits wide, and it can take a value of 00 to FFH. When the 8051 is initialized, the SP register
contains the value 07H. This means that the RAM location 08 is the first location used for the
stack. The storing operation of a CPU register in the stack is known as a PUSH, and getting the
contents from the stack back into a CPU register is called a POP.
Pushing into the Stack
In the 8051, the stack pointer (SP) points to the last used location of the stack. When data is
pushed onto the stack, the stack pointer (SP) is incremented by 1. When PUSH is executed, the
contents of the register are saved on the stack and SP is incremented by 1. To push the registers
onto the stack, we must use their RAM addresses. For example, the instruction "PUSH 1" pushes
register R1 onto the stack.
Popping from the Stack
Popping the contents of the stack back into a given register is the opposite to the process of
pushing. With every pop operation, the top byte of the stack is copied to the register specified by
the instruction and the stack pointer is decremented once.
The memory map of the 8051 looks like this:
 Code Memory (ROM): Address range from 0000H to 0FFFH (4 KB).
 Data Memory (RAM): Address range from 00H to 7FH (128 bytes).
 Special Function Registers (SFRs): Mapped to specific memory locations for controlling
peripherals and special functions.
Memory Addressing of 8051
 Direct Addressing: Accessing memory locations directly using their physical addresses.
 Indirect Addressing: Using pointers to access memory indirectly, typically via the DPTR
(Data Pointer) register.
The Intel 8051 microcontroller typically contains 128 bytes of General-Purpose RAM (Random
Access Memory). This RAM serves as a workspace for the processor during program execution
and is utilized for various temporary data storage needs.

FEATURES OF INTEL 8051 GENERAL PURPOSE RAM


128 Bytes Size: The 8051's RAM is relatively small compared to modern standards but was
sufficient for many applications at the time of its widespread use.
Variable Storage: It holds variables, data, and stack-related information during program
execution.
Stack Usage: A portion of this RAM is specifically used for the stack, storing return addresses
during subroutine calls and other essential information.
Volatile Memory: It's volatile memory, meaning its contents are lost when power is turned off.
Usage of 8051's RAM
 Data Storage: Used for storing data variables, intermediate calculations, and other
temporary values during program execution.
 Stack Operations: Handles the stack for storing return addresses and local variables when
functions or subroutines are called.
 Temporary Registers: The RAM may also serve as temporary registers for data
manipulation and calculations.

Addressing in 8051's RAM


The RAM in the 8051 is accessed using direct addressing or indirect addressing modes.
 Direct Addressing: Allows direct access to specific memory locations within the RAM.
 Indirect Addressing: Utilizes pointers, often via registers like the Data Pointer (DPTR), to
access memory indirectly.

Addressing modes of 8051


The way in which an operand is given to an instruction is known as addressing mode. Addressing
modes do exist in every processor and microcontroller, however they vary little. There are
various types of addressing modes in 8051, and important ones are:
 Immediate addressing mode.
 Register addressing mode.
 Direct addressing mode.
 Indirect addressing mode.
 Indexed addressing mode.
Immediate addressing mode:
In this type of addressing mode in 8051, data is given directly to instructions to perform
operation. Data and address of a location look the same (both are numbers ). So, a special
character ‘# is used to differentiate data from addresses.

MOV A , #16H ; this instruction means move data ( 16H ) to register A, location of 16H is not
defined here.
MOV DPTR #2000H
In any addressing mode, the processor fetches instruction , decodes the instruction and executes
it. However in this type of addressing mode , processors immediately can fetch data ( operand ),
so this is known as immediate addressing mode.
Here the MOV datatype is used which is used in internal RAM memory operations only. For
other memories ( ROM, external RAM other data types are used )

Register addressing mode:


In this type of addressing mode, instead of giving the data directly, the register name is given.
Data from one register is moved to another register, data doesn’t get erased from first register.
Generally the data is stored in general purpose registers, thus it is named as register addressing
mode.
MOV R1 , A ; it means access to the data is moved from register A to register R1. However the
data is not removed from A register, it is just copied.
MOV R1 , R0 ; this instruction is not allowed.

Direct addressing mode:


In this addressing mode of 8051 , the address of the data location is given in the instruction , This
operation is only for internal RAM and SFRs because it provides an address of only 8-bit.
MOV A , 25H ; data from 25H location is given to register A.
Here # is not used, because it is an address.
MOV 30H , A ; move A register data to 30H location.
MOV 15H , 25H ; move data from 25H location to location 15H .
MOV 01H , 00H ; This instruction is similar to MOV R1 , R0 ;
Because R1 is located at 01H address and similarly others.

Indirect addressing mode:


This addressing mode is for both internal RAM and external RAM.
Indirect addressing mode in internal RAM:

addressing modes in 8051 | Immediate addressing mode


MOV A , @R0 ; This means copying the data from the location stored in R0.
R0 has data 10, which is address of 23. It means copy 23 to register A.
MOV R0 , #10H ;
MOV A , R0 ;
These 2 instructions are expanded versions of the indirect addressing mode.
MOV R0 , #10H ; means 10H is data for R0 , not address.
MOV A , R0 ; copy the R0 data to register A

Why is indirect addressing mode when direct addressing mode is simple?


NOTE: Simple things aren’t always best! Using direct addressing mode in 8051, we can
perform single byte operations only. In microcontrollers we don’t perform single byte
operations. Using indirect addressing mode we can perform operations like loops.
Consider an example of an array which holds 100 values.
Array[0] = 1
Array[1] = 2
Array[2] = 3
.
.
.
Array[99] = 100

As shown above, In indirect addressing of 8051 , mode we can set the value of i and increment it
and then add total code in a loop. So indirect addressing mode is used to move multiple bytes of
data.
Problem:
Move the series of data from the address of a location ( 20H is the address ) to the location 50H .
Solution:
MOV R0 , #20H ; assign first byte address of 20H location as R0
MOV R1 , #50H ; assign first byte address of 50H location as R1
MOV A , @R0 ; R0 contains location of data, that data( first byte of 20H) is moved to A
MOV @R1 , A ; first byte of 20H is moved to R1
Here R1 has values of 50H
INC R0 ; increment R0
INC R1 ; increment R1
Indirect addressing mode in external RAM:
MOVX A , @DPTR ; for external RAM, MOVX is used.
DPTR is a 16-bit address register, but the data in it is 8-bit only( data in DPTR is address of
another data location ) .
Index addressing mode:
This addressing mode of 8051 microcontroller is the sum of two registers. ROM doesn’t only
consist only of program memory, it also has bit data memory in some cases.
MOVC A , @A+DPTR ;
MOVC @A+DPTR , A ; this instruction is not allowed , because ROM is only readable memory,
we cannot write in it.
For instance, Code for 8-segment displays never changes, that code is fixed and we are not
interested in changing the code, so we store this data in ROM.
In this way there are fixed codes for every number in the 7 segment display.

Then these codes ( here 8 codes ) are stored in a table known as look up table .
Look up table:
Address Code
xxxx Code for number 0
xxxx + 1 Code for number 1

xxxx + 8 Code for number 9
xxxx is the base address that could be anything, and to access other codes we have to add another
address to it.
Address of a particular code = base address + index of the code
This is the reason this type of addressing is known as index addressing mode.

8051 Assembler Operation


The 8051 microcontroller is a popular microcontroller in embedded systems and is often
programmed using assembly language. Assembly language is a low-level programming language
that corresponds closely to the machine language instructions of specific CPU architecture. Some
of the common 8051 assembly language operations are:
Data Movement Instructions:
MOV A, #data: Move immediate data to the accumulator (A register).
MOV reg, reg: Move data from one register to another.
MOV A, R0: Move data from register R0 to the accumulator.
MOV DPTR, #address: Move immediate address to the data pointer.

Arithmetic Instructions:
ADD A, reg: Add the contents of a register to the accumulator.
ADD A, #data: Add immediate data to the accumulator.
INC reg: Increment the content of a register.
INC A: Increment the accumulator.
Logical Instructions:
ANL A, reg: Perform a bitwise AND between the accumulator and a register.
ANL A, #data: Perform a bitwise AND between the accumulator and immediate data.
ORL A, reg: Perform a bitwise OR between the accumulator and a register.

Jump and Branch Instructions:


SJMP label: Unconditional short jump to a label.
JZ/JNZ label: Jump if zero/not zero.
CJNE A, #data, label: Compare and jump if not equal.

Loop Instructions:
DJNZ reg, label: Decrement and jump if not zero.
Subroutine Instructions:
CALL subroutine: Call a subroutine.
RET: Return from a subroutine.

Bit-Level Instructions:
SETB bit: Set a specified bit in the RAM.
CLR bit: Clear a specified bit in the RAM.

Stack Instructions:
PUSH reg: Push the content of a register onto the stack.
POP reg: Pop the top of the stack into a register.

I/O Port Instructions:


MOVX A/@DPTR: Move external data to accumulator.
MOVX @DPTR, A: Move accumulator to external data.
ASSEMBLY LANGUAGE FORMAT OF 8051
The assembly language for the 8051 microcontroller has a specific format. Here is a general
overview of the format:
Labels: Assembly language instructions often start with a label. Labels are used for defining
addresses and for branching instructions.
Example: START: MOV A, #25
Instructions: Instructions are the actual operations that the microcontroller performs.
Example: MOV A, #25
Operands: Operands are the data or registers involved in an instruction.
Example: MOV A, #25 - Here, A is the accumulator, and #25 is immediate data.
Comments: Comments are used to explain the code and are ignored by the assembler.
Example: This is a comment
Directives: Directives provide information to the assembler but are not executed by the
microcontroller.
Example: ORG 0x8000 (defines the origin of the program in memory)
Registers: Registers in the 8051-assembly language include the accumulator (A), B register (B),
and various general-purpose registers (R0 to R7).
Example: MOV A, B
Addressing Modes: 8051 supports various addressing modes, such as immediate, direct,
register, and indirect addressing.
Example of immediate addressing: MOV A, #25
Instructions with Mnemonics: Instructions use mnemonics that represent specific operations.
Example: MOV (move data), ADD (addition), JMP (jump), etc.

PROGRAM EXAMPLE:
ORG 0x8000 ; Set the origin of the program
START:
MOV A, #25 ; Move immediate data 25 to accumulator A
MOV R0, A ; Move the content of A to register R0
ADD A, R0 ; Add the content of R0 to A
JZ LOOP ; Jump to LOOP if A is zero
JMP END ; Jump to END
LOOP:
INC R0 ; Increment the content of R0
NOP ; No operation (placeholder)
END:
NOP ; No operation at the end
In this program example, ORG sets the origin of the program, START is a label, and instructions
like MOV, ADD, JZ, and JMP perform specific operations. The program uses registers (A and
R0) and includes labels for branching.

ASSEMBLER DIRECTIVE
Assembler directives help in organizing the assembly code, defining constants, allocating
memory space, and indicating code and data segments. The exact set of directives and their
syntax may vary slightly depending on the assembler being used. Always refer to the
documentation of the specific assembler for accurate and detailed information. In the context of
the 8051 microcontroller, assembler directives are specific commands that provide instructions to
the assembler, helping in the organization and layout of the program. Here are some common
8051 assembler directives:
ORG (Origin): Syntax: ORG address
Description: Specifies the origin (starting) address of the program in memory.
Example: ORG 0x8000
END: Syntax: END
Description: Marks the end of the assembly code.
Example: END
EQU (Equate): Syntax: label EQU value
Description: Defines a constant value for a label.
Example: COUNT EQU 10
DB (Define Byte): Syntax: label DB value1, value2, ...
Description: Reserves memory space and initializes it with byte values.
Example: DATA DB 25, 30, 12
DW (Define Word): Syntax: label DW value1, value2, ...
Description: Reserves memory space and initializes it with 16-bit (word) values.
Example: TABLE DW 1000, 2000, 3000
DS (Define Space): Syntax: label DS size
Description: Reserves a block of memory without initializing it.
Example: BUFFER DS 20
SEGMENT: Syntax: SEGMENT data/code
Description: Specifies whether the following code or data is stored in the code or data segment.
Example: SEGMENT CODE
CODE: Syntax: CODE
Description: Indicates the start of the code segment.
Example: CODE
DATA: Syntax: DATA
Description: Indicates the start of the data segment.
Example: DATA
IDATA (Internal Data): Syntax: IDATA
Description: Declares the following variables to be stored in the internal RAM (data memory).
Example: IDATA
XDATA (External Data): Syntax: XDATA
Description: Declares the following variables to be stored in the external RAM (extended data
memory).
Example: XDATA
Operation of Assemblers and Linkers in 8051
The assembly and linking process for the 8051 microcontroller involves several steps. Such as:
Assembly:The assembler is a program that translates assembly language code into machine code
(binary) that the 8051 microcontrollers can execute. It converts human-readable mnemonics and
symbols into the corresponding machine instructions.
Assembly File: This is the source code written in assembly language with a file extension like
.asm.
Syntax Checking: The assembler performs syntax checking to ensure that the assembly code
follows the correct syntax for the 8051 architectures.
Symbol Resolution: It resolves symbols and assigns memory addresses to variables and labels.
Example using an imaginary assembly file, example.asm:
assembly
Copy code
ORG 0x8000
MOV A, #25
MOV R0, A
ADD A, R0
JZ LOOP
JMP END

LOOP:
INC R0
NOP
END:
NOP
Command to assemble the code using an assembler (if this is called assembler8051):
bash
Copy code
assembler8051 example.asm -o example.obj
This produces an object file (example.obj) containing the machine code.
Linker: The linker combines multiple object files, resolves addresses, and creates the final
executable file. It links together different modules, handles references between them, and ensures
that the program is correctly mapped to the memory.
Linker Script: The linker uses a script to specify the memory layout and segment placement for
the final executable.
Generating Hex File: The linker often produces a hex file that can be directly programmed into
the 8051 microcontroller's memory.
Example using an imaginary linker (let's call it linker8051):
bash
Copy code
linker8051 example.obj -o example.hex
This command links the object file (example.obj) and produces the final hex file (example.hex).
Programming the Microcontroller: The resulting hex file (example.hex) can be loaded into the
8051 microcontroller's memory using a programmer tool or hardware.

Sample Programs
Example 1: Adding Two Numbers
assembly
Copy code
ORG 0x8000 ; Start address
MAIN:
MOV A, #25 ; Load value 25 into accumulator A
MOV B, #30 ; Load value 30 into register B
ADD A, B ; Add B to A, result in A
; Result (A) is now 55
; Add your code here to use or display the result
JMP $ ; Infinite loop
END
Example2: Simple Loop
assembly
Copy code
ORG 0x8000 ; Start address
MAIN:
MOV R0, #0 ; Initialize register R0 with 0

LOOP:
INC R0 ; Increment R0
; Add your code here to use or display the value in R0
CJNE R0, #10, LOOP ; Compare R0 with 10, jump to LOOP if not equal
JMP $ ; Infinite loop
This program demonstrates a simple loop that increments a register (R0) and repeats until the
value reaches 10.

On-Chip Peripheral Devices


The 8051 microcontrollers, like many other microcontrollers, comes equipped with various on-
chip peripheral devices to facilitate interfacing with the external world. Some of the devices are:
I/O ports, timers, serial port, and their operations: These on-chip peripherals greatly enhance the
capabilities of the 8051 microcontroller, making it suitable for a wide range of applications,
including embedded systems, automation, and control systems. Understanding and effectively
utilizing these peripherals are crucial for developing efficient and versatile embedded systems
with the 8051 microcontrollers.
I/O Ports (Port 0, Port 1, Port 2, Port 3):
Port 0 (P0):
Operations: Bidirectional 8-bit I/O port.
Uses:
 Commonly used for general-purpose digital I/O.
 Often used to interface with LEDs, switches, and other digital devices.
 Can be used for address and data bus when interfacing with external memory.
Port 1 (P1):
Operations: Bidirectional 8-bit I/O port.
Uses:
 Similar to P0, used for general-purpose I/O.
 Commonly used for interfacing with external devices and peripherals.
Port 2 (P2):
Operations: Bidirectional 8-bit I/O port.
Uses:
 Often used for interfacing with external memory.
 Also used for general-purpose I/O.
Port 3 (P3):
Operations: Bidirectional 8-bit I/O port.
Uses:
 Commonly used for special functions like interrupts and serial communication.
 Can be used for general-purpose I/O.
Timers:
Timers in the 8051 microcontroller, like Timer 0 (T0) and Timer 1 (T1), are widely used for
various timing and counting applications.
Timer Operations
Timer Modes: Timers can operate in different modes, including 16-bit mode and 8-bit mode.
Counting: Timers can count external events or generate time delays.
Interrupts: Timers can generate interrupts when they overflow.
Timer Programming:
Registers: Control registers (TCON, TMOD, etc.) are used to configure timers.
Prescaler: Some timers have prescalers to divide the clock frequency.
Timer Applications
Delay Generation: Timers are used to generate precise time delays.
Pulse Width Modulation (PWM): Timers can be used to generate PWM signals.
Frequency Measurement: Timers can measure external frequencies.
Serial Port (UART):
Serial Port Operations:
Universal Asynchronous Receiver/Transmitter (UART): Provides serial communication.
Baud Rate: Configurable baud rate for communication.
Full-Duplex: Allows both sending and receiving of data simultaneously.
Serial Port Programming:
Registers: Control registers (SCON, SBUF) are used for configuration.
Interrupts: UART can generate interrupts upon receiving/transmitting data.
Serial Port Applications:
Communication with Peripherals: Used for communication with other devices like sensors,
displays, etc.
PC Interface: Used for communication with a computer.
Wireless Communication: UART can be used for wireless communication with modules like
Bluetooth or Wi-Fi.
Serial Port Interrupt:
Interrupt Source: UART can generate interrupts for various events like receiving a byte,
transmitting a byte, etc.
Interrupt Service Routine (ISR): Programmer defines ISR to handle serial port interrupts.

INTERFACING TO EXTERNAL DEVICES


Interfacing to external memory, keypad, seven-segment LED display, ADC (Analog-to-Digital
Converter), DAC (Digital-to-Analog Converter), and input/output port expansion are common
tasks in embedded systems. Here's an overview of each interfacing scenario:
 Interfacing to External Memory: The 8051 microcontroller often has limited on-chip
memory. To expand the available memory, external memory interfacing is used.
External memory could be RAM, ROM, or both.
Uses:
 Larger program storage space.
 Additional data storage.

 Interfacing to Keypad: A keypad is an input device that typically consists of a set of keys
arranged in a matrix. The keys are connected to the microcontroller through rows and
columns.
Uses:
 Input device for human-machine interaction.
 Commonly used in security systems, digital locks, etc.

 Interfacing to Seven-Segment LED Display: A seven-segment LED display is used to


represent numbers and some alphabets using seven segments. Each segment is
individually controlled.
Uses:
 Displaying numerical information in a visual format.
 Used in digital clocks, temperature displays, etc.

 Interfacing to ADC (Analog-to-Digital Converter): ADC is used to convert analog


signals into digital values. The 8051 does not have an on-chip ADC, so external ADC
chips are used.
Uses:
 Reading analog sensor values (e.g., temperature, light intensity).
 Monitoring physical quantities.

 Interfacing to DAC (Digital-to-Analog Converter): DAC is used to convert digital values


into analog signals. Useful for generating analog signals based on digital data.
Uses:
 Audio generation.
 Signal conditioning.

 Input/Output Port Expansion: Sometimes, the on-chip I/O ports of the microcontroller
may not be sufficient for a complex system. Port expander ICs can be used to increase
the number of I/O pins.
Uses:
 Expanding the number of available I/O pins.
 Connecting multiple devices to the microcontroller.

Hardware Development Tools


1. Microcontroller Development Board: A platform that includes the microcontroller, power
supply, crystal oscillator, and often has headers for easy interfacing. It is used for prototyping and
testing microcontroller-based projects.
2. In-Circuit Emulator (ICE): Hardware tool for real-time debugging and testing of embedded
systems. Used for debugging complex programs running on the microcontroller.
3. Oscilloscope: Measures and displays voltage signals as they vary over time. Used for
debugging analog circuits, analyzing signal waveforms.
4. Logic Analyzer: Captures and displays digital signals. Used for Analyzing digital signal
behavior, debugging digital circuits.
5. Programmer: Device used to burn the compiled program into the microcontroller's memory.
Used for Loading firmware into the microcontroller.
6. Power Supply: Provides the necessary voltage and current to power the microcontroller and
associated circuitry. Used for powering the embedded system during development and testing.

MOTOROLA M6811 Microcontroller

The Motorola M6811 is a microcontroller that belongs to the Motorola 6800 series of
microprocessors and microcontrollers. The M6811 is an 8-bit microcontroller that was widely
used in embedded systems and control applications. It descended from the Motorola 6800
microprocessor by way of the 6801. The 68HC11 devices are more powerful and more expensive
than the 68HC08 microcontrollers and are used in automotive applications, barcode readers,
hotel card key writers, amateur robotics, and various other embedded systems. The
MC68HC11A8 was the first microcontroller to include CMOS EEPROM
Here are some key features and characteristics of the Motorola M6811:

Architecture of M6811 Microcontroller


The M6811 is based on the Motorola 6800 CPU architecture. It is an 8-bit processor, meaning it
processes data in 8-bit chunks.
Memory:
 The M6811 typically has an on-chip ROM (Read-Only Memory) and RAM (Random
Access Memory).
 External memory can be interfaced with the microcontroller for additional storage.
Peripheral Interface:
 The M6811 has various on-chip peripherals, including timers, counters, parallel I/O ports,
serial communication ports, and more.
 These peripherals make it well-suited for a wide range of applications, from simple
control systems to more complex embedded systems.
Clock Speed:
The clock speed of the M6811 can vary, and different versions of the microcontroller may have
different clock frequencies.
Instruction Set:
The instruction set of the M6811 is based on the original 6800 instruction set, with some
enhancements and additional instructions tailored for embedded control applications.
Development Tools:
 Development tools, including assemblers, compilers, and debuggers, were available for
programming the M6811.
 Cross-development environments allow developers to write and test code on a host
computer before transferring it to the target M6811 system.
Applications:
The M6811 found applications in a variety of embedded systems, including automotive control
systems, industrial automation, medical devices, and consumer electronics.
Block Diagram of 68HC11 Microcontroller
Pin Definitions of the M6811 Microcontroller
The pin configuration of a microcontroller M6811, is crucial for interfacing with external devices
and components. Below are some common pin functions found in microcontrollers of the M6811
family.
VCC and GND:
VCC (Voltage Supply): The pin that receives the positive power supply voltage.
GND (Ground): The pin connected to the ground reference for the circuit.
RESET:
RESET: This pin is used to reset the microcontroller. When a reset signal is applied, the
microcontroller initializes and starts executing code from a predefined location.
XTAL1 and XTAL2:
XTAL1 and XTAL2: These pins are associated with an external crystal oscillator or resonator.
They provide the clock signal for the microcontroller's internal operations.
Ports (PA, PB, PC, etc.):
Ports: These pins are general-purpose I/O (Input/Output) pins. They can be configured as either
inputs or outputs, allowing the microcontroller to interface with external devices.
IRQ and NMI:
IRQ (Interrupt Request): This pin is used for external interrupt requests.
NMI (Non-Maskable Interrupt): This pin is reserved for non-maskable interrupt requests, which
take priority over regular interrupts.
Serial Communication Pins (RXD, TXD):
RXD (Receive Data): This pin is used for serial data input.
TXD (Transmit Data): This pin is used for serial data output.
Timer/Counter Pins (TxC, TOC, etc.):
Timer/Counter Pins: These pins are associated with on-chip timers and counters, and they
provide input/output for timing and counting functions.
A/D Converter Pins (AN0, AN1, etc.):
Analog-to-Digital Converter (ADC) Pins: These pins are used for analog input to the
microcontroller for conversion to digital values.
Control Pins (E, RW, RS, etc.): Control Pins: These pins are used for controlling the
microcontroller's operation, such as read/write operations, selecting register banks, and
indicating the type of operation (e.g., data or command).

I/O port structure of M6811


The M6811 microcontroller features several I/O (Input/Output) ports that can be configured as
either inputs or outputs to interface with external devices. Among which are:
Parallel I/O Ports:
The M6811 typically has multiple parallel I/O ports, often labeled as Port A (PA), Port B (PB),
Port C (PC), etc. Each port consists of a certain number of pins that can be individually
configured as input or output.
Bidirectional I/O:
The I/O ports in the M6811 are bidirectional, meaning that each pin can serve as both an input
and an output. The direction of each pin is determined by software configuration.
Data Direction Register (DDR):
The Data Direction Register (DDR) is used to configure the direction of each I/O pin. A '1' bit in
the DDR indicates the corresponding pin is configured as an output, while a '0' bit indicates an
input. Writing to the DDR allows you to set the direction of individual pins on the I/O ports.
Data Register (DR):
The Data Register (DR) holds the actual data for the I/O pins when they are configured as
outputs.
When configured as inputs, the DR is used to read the status of the pins.
Port Control Register (PCR):
Some microcontrollers, including certain variants of the M6811, may have a Port Control
Register (PCR) associated with each port. This register allows additional configuration options
for the I/O pins, such as pull-up/pull-down resistors or alternate functions.
Interrupts:
Certain I/O pins may be associated with interrupt capabilities. Configuring interrupts on specific
pins allows the microcontroller to respond to external events.
Analog-to-Digital Converter (ADC):
Some pins on the I/O ports may have analog input capabilities for interfacing with sensors or
other analog devices. These pins are often labeled as AN0, AN1, etc., and are associated with the
built-in ADC.
Special Function Pins:

The I/O ports may also include pins with special functions, such as those dedicated to serial
communication (TXD, RXD) or clock input (XTAL1, XTAL2).
Bit Manipulation:
The software can manipulate individual bits within the I/O ports using bitwise operations,
allowing for efficient control of specific pins without affecting others.

Memory Organization of 68M11 Microcontroller


The memory organization of a microcontroller like the Motorola M68HC11 involves various
types of memory and their arrangements. The M68HC11, typically integrates multiple types of
memory to facilitate program execution, data storage, and interaction with peripherals.
Components of memory organization in the M68HC11 include:
Program Memory (ROM):
The M68HC11 usually has on-chip program memory (ROM) where the machine code
instructions are stored. This memory is non-volatile, meaning its contents are retained even when
power is turned off.
Data Memory (RAM):
Data memory is used for temporary storage of variables and data during program execution. The
RAM is typically volatile, meaning its contents are lost when power is turned off. It's organized
into different banks, and the size can vary depending on the specific variant of the M68HC11.
Stack Memory:
The microcontroller often includes a stack, a region of RAM used for storing subroutine return
addresses, local variables, and other temporary data. The stack is crucial for managing function
calls and interrupts.
Bit-Addressable Memory:
Some portions of the RAM may be bit-addressable. This means that individual bits within a byte
can be individually addressed and manipulated.
Registers:
In addition to RAM, the microcontroller includes various registers, some of which are general-
purpose, while others are special function registers (SFRs). General-purpose registers are used
for arithmetic and data manipulation, while SFRs control specific features and peripherals.
Memory-Mapped I/O:
Certain addresses in the memory space are reserved for memory-mapped I/O. Reading from or
writing to these addresses allows the microcontroller to communicate with peripherals such as
timers, serial communication modules, and other on-chip devices.
External Memory Interface:
The microcontroller may support interfacing with external memory devices, such as additional
ROM or RAM. External memory can be used to extend the available storage space for program
code or data.
Memory Space Mapping:
The memory space of the M68HC11 is organized into different regions, each serving a specific
purpose (e.g., program memory, data memory, I/O space). Memory space mapping involves
defining the address ranges for these different regions.
Memory Decoding:
Memory decoding circuits determine which memory region corresponds to a particular address
during memory access. These circuits help route data and control signals to the correct memory
location.

General purpose RAM and Bit Addressable RAM of 68M11


The Motorola M68HC11 microcontroller, including its various variants, features general-purpose
RAM and certain regions of memory that are bit-addressable. M68HC11 typically includes on-
chip RAM that serves as general-purpose memory for storing variables and data during program
execution. The RAM is often organized into multiple banks or sections, and the size can vary
depending on the specific variant of the M68HC11. It is volatile memory, meaning that its
contents are lost when power is turned off.
Bit-Addressable Memory:
Certain regions of the RAM in the M68HC11 are bit-addressable. This means that individual bits
within a byte can be directly addressed and manipulated. The bit-addressable memory is often
used for setting or clearing specific flags, control bits, or other situations where individual bit
manipulation is required.
In the M68HC11, specific registers or memory locations are designated as bit-addressable. These
locations allow for efficient manipulation of individual bits without affecting the entire byte. Bit-
addressable memory is commonly used for managing control flags, configuration settings, or
status bits in embedded systems.

Memory Map of M68HC11


The M6811 is a microprocessor that belongs to the 6800-microprocessor family. Memory
mapping in the context of microprocessors refers to the organization and addressing of memory
in the system. The M6811, like other microprocessors, has a specific memory map that defines
how different types of memory (RAM, ROM, I/O ports, etc.) are accessed.

General Overview of the Memory Map for M6811


RAM (Random Access Memory: RAM is typically divided into different sections, such as data
RAM and stack RAM. The data RAM is used for storing variables and temporary data during
program execution. The stack RAM is used for managing subroutine calls and storing local
variables.
ROM (Read-Only Memory: The ROM contains the program code that the processor fetches and
executes. There may be different types of ROM depending on the specific M6811 variant, such
as EPROM (Erasable Programmable Read-Only Memory) or flash memory.
I/O Ports: The M6811 has a set of I/O ports for interfacing with external devices. Different ports
may be designated for input and output operations, such as connecting to sensors, displays, or
communication peripherals.
Control Registers: Special-purpose registers are often mapped to specific addresses in the
memory space. These registers control various aspects of the processor, such as interrupt
handling, clock configuration, and other system-level functions.
Peripheral Devices: Memory-mapped peripheral devices, like timers, counters, and
communication interfaces (UART, SPI, I2C), may have specific regions in the memory map. It's
important to note that the exact memory map can vary depending on the specific M6811 variant
and the system configuration. The memory map is usually defined by the manufacturer and
documented in the processor's datasheet or reference manual. Programmers must refer to these
documents to understand the specific memory organization for a particular M6811 variant.

Instruction Set and Assembly Language Programming of M88C11


The M6811 microprocessor has its own instruction set architecture (ISA), which defines the set
of instructions that the processor can execute. Assembly language programming for the M6811
involves writing human-readable instructions, called assembly language instructions, that
correspond directly to the machine code instructions understood by the M6811 processor.

Overview of the M6811 instruction set and assembly language programming:


Data Movement Instructions
LDAA, LDAB: Load Accumulator A or B with a value from memory.
STAA, STAB: Store the contents of Accumulator A or B memory.
LDA, STA: General-purpose load and store instructions.
Arithmetic and Logic Instructions
ADDA, ADDB: Add the contents of Accumulator A or B.
SUBA, SUBB: Subtract the contents of Accumulator A or B.
ANDA, ANDB: Perform bitwise AND operation.
ORA, ORB: Perform bitwise OR operation.
EORA, EORB: Perform bitwise XOR operation.
Branching and Control Flow Instructions
BRA: Unconditional branch.
BEQ, BNE: Branch if equal or not equal.
BCS, BCC: Branch if carry set or clear.
BMI, BPL: Branch if negative or positive.
JSR: Jump to subroutine.
Comparison Instructions
CMPA, CMPB: Compare Accumulator A or B with a value.
Increment and Decrement Instructions
INCA, INCB: Increment Accumulator A or B.
DECA, DECB: Decrement Accumulator A or B.
Stack Operations
TSX: Transfer Stack Pointer to Index Register.
TXS: Transfer Index Register to Stack Pointer.
Bit Manipulation Instructions
BITA, BITB: Bit test on Accumulator A or B.
LSLA, LSLB: Logical shift left on Accumulator A or B.
RORA, RORB: Rotate right through carry on Accumulator A or B.
Input/Output Instructions:
LDX, STX: Load and store the Index Register.
I/O instructions for interfacing with peripheral devices.
Conditional Instructions:
CPX, BGE, BGT, etc.: Conditional branch instructions based on the state of the Index Register.

Hello World program for M6811


ORG $4000 ; Start address of the program
LDAA #72 ; ASCII code for 'H'
STAA $1000 ; Store 'H' in memory
LDAA #69 ; ASCII code for 'E'
STAA $1001 ; Store 'E' in memory
LDAA #76 ; ASCII code for 'L'
STAA $1002 ; Store 'L' in memory
LDAA #76 ; ASCII code for 'L'
STAA $1003 ; Store 'L' in memory
LDAA #79 ; ASCII code for 'O'
STAA $1004 ; Store 'O' in memory
SWI ; Software interrupts to halt the program

Addition program for M6811


ORG $4000; Start address of the program.
LDAA #10 ; Load value 10 into Accumulator A
LDAB #5 ; Load value 5 into Accumulator B
ADDA B ; Add contents of Accumulator B to Accumulator A
STAA $1000; Store the result in memory.
SWI ; Software interrupts to halt the program
Looping program for M6811
ORG $4000 ; Start address of the program
LDAA #5 ; Initialize counter with 5
STAA $1000 ; Store the counter in memory
LOOP:
; Your loop code here
DEC $1000 ; Decrement the counter
BNE LOOP ; Branch back to LOOP if the counter is not zero
SWI ; Software interrupt to halt the program

The PIC Microcontroller


The PIC microcontroller is a family of microcontrollers produced by Microchip Technology,
originally developed by General Instrument's Microelectronics Division. PIC stands for
"Peripheral Interface Controller," although it is often colloquially referred to as "Programmable
Intelligent Computer." PIC microcontrollers are widely used in embedded systems, and they find
applications in a diverse range of electronic devices, including appliances, automotive systems,
medical devices, and industrial control systems.
PIC Architecture: PIC microcontrollers typically have Harvard architecture, which means
separate memory spaces for program and data. This architecture allows simultaneous access to
program memory and data memory, contributing to increased performance.

Memory Organization
Program Memory (Flash): Stores the program code and is non-volatile, allowing the code to
persist even when power is removed.
Data Memory (RAM): Used for storing variables and temporary data during program execution.
EEPROM: Electrically Erasable Programmable Read-Only Memory, used for storing non-
volatile data that may need to be preserved across power cycles.
Instruction Set: PIC microcontrollers have a reduced instruction set computing (RISC)
architecture, which means they have a small, highly optimized set of instructions. This
contributes to faster execution of instructions. Common instructions include arithmetic and logic
operations, branching, bit manipulation, and control flow instructions.
Peripherals: PIC microcontrollers offer a variety of on-chip peripherals such as timers, counters,
USART (Universal Synchronous/Asynchronous Receiver/Transmitter), SPI (Serial Peripheral
Interface), I2C (Inter-Integrated Circuit), ADC (Analog-to-Digital Converter), and more. The
rich set of peripherals allows for interfacing with sensors, communication modules, and other
external devices.
Development Tools: Microchip provides a comprehensive set of development tools for PIC
microcontrollers, including integrated development environments (IDEs) such as MPLAB X,
compilers, simulators, and debuggers.
Programming Languages: PIC microcontrollers can be programmed using assembly language or
high-level programming languages such as C. MPLAB XC compilers are commonly used for C
programming.
Variants and Families: PIC microcontrollers come in various families and series, each designed
for specific applications and requirements. Examples include PIC10, PIC12, PIC16, and PIC18
families.
Community Support: The PIC microcontroller community is active, with a wealth of online
resources, forums, and documentation available. This makes it easier for developers to find
support and share knowledge.
Low Power Options: Many PIC microcontrollers are designed for low-power applications,
making them suitable for battery-powered devices and other energy-efficient applications.
PIC microcontrollers typically follow Harvard architecture, featuring separate program
memory and data memory spaces. This allows simultaneous access to program instructions and
data, contributing to enhanced performance.
Central Processing Unit (CPU): The CPU executes instructions fetched from program memory
and manipulates data stored in data memory.
Memory Organization: Program Memory (Flash): Stores the firmware or program code.
Data Memory (RAM): Used for storing variables and temporary data during program
execution.
EEPROM: Electrically Erasable Programmable Read-Only Memory for non-volatile data
storage.
Peripherals: On-chip peripherals include timers, counters, communication interfaces (USART,
SPI, I2C), analog-to-digital converters (ADC), pulse-width modulation (PWM), and more. These
peripherals enhance the microcontroller's ability to interface with external devices and sensors.
Clock and Reset: PIC microcontrollers have an internal oscillator, and some variants support an
external crystal oscillator for accurate timing. Reset circuits ensure reliable startup and operation.
I/O Ports: Input/Output ports facilitate communication with external devices and sensors.
Applications of PLC
Embedded Systems: PIC microcontrollers are widely used in embedded systems for control
applications in appliances, automotive systems, industrial automation, and consumer electronics.
Automotive: Used in engine control units (ECUs), airbag systems, and various automotive
control applications.
Medical Devices: Employed in medical instruments and monitoring devices.
Industrial Control: Used in programmable logic controllers (PLCs), motor control, and other
industrial automation applications.
Consumer Electronics: Found in devices like smart home appliances, remote controls, and
electronic gadgets.
Communication Devices: Applied in communication devices, including modems and
networking equipment.
Selection Criteria for Microcontroller
Application Requirements: Choose a microcontroller that meets the specific requirements of
the application, considering factors such as processing power, memory, and peripherals.
Power Consumption: Evaluate power consumption based on the application's power
requirements, especially for battery-powered devices.
Peripherals and Interfaces: Select a microcontroller with the necessary peripherals and
communication interfaces for interfacing with sensors, actuators, and other external devices.
Cost: Consider the cost of the microcontroller and associated development tools in relation to the
project budget.
Development Tools and Support: Evaluate the availability and quality of development tools,
including compilers, IDEs, and community support.
Package and Size: Consider the physical size and package type of the microcontroller,
especially in space-constrained applications.
Advantages of PIC Microcontrollers
Versatility: PIC microcontrollers are versatile and suitable for a wide range of applications.
Rich Peripheral Set: On-chip peripherals provide flexibility and reduce the need for external
components.
Low Power Options: Many PIC microcontrollers offer low-power modes, making them suitable
for battery-operated devices.
Development Tools: Microchip provides comprehensive development tools, including free
MPLAB X IDE and XC compilers.
Community Support:. Low-End and High-Performance PIC Microcontrollers:
Low-End PIC Microcontrollers: Examples include PIC10 and PIC12 families. Suited for simple
control applications with low resource requirements.
Limited program and data memory, basic peripherals. High-Performance PIC Microcontrollers:
Examples include PIC18, PIC32 families.
Suitable for complex applications with higher processing power and memory requirements.
Advanced peripherals, larger memory capacity, and enhanced features.

You might also like