MA Unit1 Part 1
MA Unit1 Part 1
2. CIP-51 Architecture
2. Skills:
• To write assembly language and embedded C programs.
• To apply knowledge for the development of multidisciplinary projects.
3.Attitude:
• To select the appropriate microcontroller for the desired application.
• To develop real-world applications using a microcontroller.
Course Objectives & Course Outcomes :
2. Make use of Integrated Development Environment (IDE) for programming and debugging.
(CL-III)
• CIP-51 Architecture: Reset sources, Oscillator options, Memory Organization, Port structure, Timers,
Timer programming, Interrupt handler, Power management modes. (All programs in Embedded C).
• Peripheral Interfacing and Programming-I: Interfacing of LED, Relay, Buzzer, Switch, 7-segment
display, LCD, Keypad, Stepper Motor, DAC ADC programming, Programmable Counter Array (PCA), DC
motor control using PWM (All programs in Embedded C).
7. Interfacing DC motor and control its speed using PWM with C8051F340.
• CCA- 30 Marks:
✔Assignment(15M)+
✔Midterm(15M)
• LCA- 30 Marks:
✔Expt -10Marks +
✔Midterm Exam 10Marks+
✔Endterm 10M
Part 1
Contents
• Microprocessor and Microcontroller comparison,
• Memory organization
• Instruction set
• Assembly programming
Terminologies:
• Integrated Circuit (IC): A miniaturized electronic circuit that consists of
semiconductor devices and passive components contained in a package.
• Central Processing Unit (CPU): This refers to the core of the MCU that
executes code
• “n-bit” – the “n” refers to the data bus width of the CPU, and is the maximum
width of data it can handle at a time
• Examples: 8-bit MCU, 32-bit MCU
Micro-processors and Microcontrollers
2. Memory and I/O has to be connected externally, Memory and I/O are already present, and the internal
so the circuit becomes large. circuit is small.
3. Microprocessors are based on Von Neumann Micro controllers are based on Harvard architecture
model
4 High Processing Power in terms of instruction Low processing Power in terms of instruction
execution(MIPS) execution(MIPS)
5 CPU word size can be 16/ 32/64 bit CPU word size can be 8/16/32 bit
6 It has no RAM, ROM, Input-Output units, timers, It has a CPU along with RAM, ROM, and other
and other peripherals on the chip. peripherals embedded on a single chip.
7 It’s used for general purpose It’s used for application-specific systems.
applications that allow you to handle loads of data
Microprocessor Vs Microcontroller
Microprocessor Microcontroller
General purpose Processor Application specific
Bulkier and Expensive A single chip and cost effective
High computing power Can perform limited calculations
More power consumption Less power consumption
Only word/ byte transferable Also bit transferable
Pins are fixed Port pins are programmable
Very fast (> 1GHz) Relatively slow (typically 10-
20MHz) since most I/O devices
being controlled are relatively slow.
Eg. Intel 8085, 8086, Motorola’s Eg. Intel’s MCS-51, Atmel’s AT89c51
680x
https://raspberrytips.com/is-raspberry-pi-a-microcontroller/
Role of microcontroller in Embedded System
• A combination of hardware and software designed to perform a dedicated
function
• Embedded systems are computing systems with tightly coupled hardware and
software integration.
• Designed to perform dedicated function
• Embedded systems are part of a larger system or product,
-e.g., antilock braking system in a car (The anti-lock braking system
means the system that prevents the wheels from locking when the brakes are
applied in a moving car. )
• Embedded systems are tightly coupled to their environment 🡪 imposes real-
time constraints by the need to interact with the environment
Embedded Products Using Microcontrollers (Applications)
• Home
• Appliances, intercom, telephones, security systems, garage door openers, answering
machines, fax machines, home computers, TVs, cable TV tuner, VCR, camcorder,
remote controls, video games, cellular phones, musical instruments, sewing machines,
lighting control, paging, camera, pinball machines, toys, exercise equipment
• Office
• Telephones, computers, security systems, fax machines, microwave, copier, laser
printer, color printer, paging
• Auto
• Trip computer, engine control, air bag, instrumentation, security system, transmission
control, entertainment, climate control, cellular phone, keyless entry
Is 8-bit Still Relevant?
• “n-bit” – the “n” refers to the data bus width of the CPU, and is the
maximum width of data it can handle at a time.
• More and more advanced features and peripherals are added to 8-bit
processors by various vendors
• 8-bit MCUs are well-suited for low-power applications that use batteries.
8-bit MCUs tend to be easier to program and understand on a
deep level compared to 32-bit.
The 8051 Microcontroller—A Brief History
• In 1980, Intel introduced the 8051, relevant today after more than two
decades
• First device in the MCS-51® family of 8-bit microcontrollers
• In addition to Intel there are other second source suppliers of the ICs, who
make microcontrollers that are compatible with the 8051 architecture.
• In recent years some companies have incorporated many different and
additional features into 8051
• In 2000, Silicon Laboratories introduced CIP-51 microcontroller chip
(C8051F340) based on the 8051 core CPU
• Silicon Labs is a leading manufacturer of 8051 based microcontroller.
https://www.manualslib.com/manual/152880/Silicon-Laboratories-C8051f341.html?
page=73#manual
Von Neumann and Harvard architecture
• Von Neumann Architecture: It is a digital computer architecture whose design is based
on the concept of stored program computers where program data and instruction data
are stored in the same memory.
• This architecture was designed by the famous mathematician and physicist John Von
Neumann in 1945.
Both CISC and RISC approaches primarily try to increase the performance of a CPU.
Here is how both of these work:
1. CISC: This kind of approach tries to minimize the total number of instructions per program, and it does
so at the cost of increasing the total number of cycles per instruction.
2. RISC: It reduces the cycles per instruction and does so at the cost of the total number of instructions per
program.
RISC Vs CISC Sr.
: Properties RISC (Reduced Instruction CISC (Complex
No. Set Computer) Instruction Set Computer)
1 No. of Instructions Less More
2 Addressing Modes Less More
3 Instruction Formats Less More
4 Instruction Size Fixed Variable
5 Control Unit Hardwired Micro-programmed
6 No. of Bus Cycles to Single CPU cycle (for 80% Multiple CPU cycles
execute an instruction Instructions)
7 Control Logic & Simple Complex
Decoding Subsystem
8 Pipelining Huge no. of stages of Difficulty in efficient
Pipelining implementation
9 Design time & Smaller time & less probable Long time & Significant
Probability of Design probability
Errors
10 Complexity of Compiler Simpler More complex
11 HLL(High level Supported Not supported
language) Instructions
* A pipeline is the mechanism a RISC processor uses to execute instructions. Using a pipeline speeds up execution by fetching the next
instruction while other instructions are being decoded and executed.
RISC vs. CISC
RISC (Reduced Instruction Set Computer) CISC (Complex Instruction Set Computer )
2. Only LOADs, STOREs access memory 2. Any Instruction may access memory
* A pipeline is the mechanism a RISC processor uses to execute instructions. Using a pipeline speeds up execution by fetching the next
instruction while other instructions are being decoded and executed.
Concept of Pipeline
Fetch
Decode
Execute
Features of C8051F340 AT A GLANCE
What is the highest speed the micro controller supports
Does it comes in 40-pin DIP (Dual inline package) or QFP (Quad flat package)
Program Memory: in the classic 8051, this is a 64KB space called CODE. Typically, this region is a ROM
space that used for the program code and constants. Constants are fetched with the MOVC instruction.
Internal Data Memory: in the classic 8051, this is the on-chip RAM space with a maximum of 256 Bytes
containing register banks, BIT space, direct addressable DATA space, and indirect addressable IDATA space.
This region should be used for frequently used variables.
External Data Memory: in classic 8051 devices, this area, called XDATA, is off-chip RAM with a space of up
to 64KB.
However, several new 8051 devices have additional on-chip RAM that is mapped into the XDATA space.
Usually, this additional on-chip RAM has to be enabled via dedicated SFRs.
9.2.7. Register Descriptions
2. Register banks are selected by RS1 and RS0 bits in the program status word
Programming using RAM location
0V Overflow flag (The result of signed number operation is too large, causing the high-order bit to overflow into the sign bit)
This bit is set to 1 under the following circumstances: • An ADD, ADDC, or SUBB instruction causes a sign-change overflow.
• A MUL instruction results in an overflow (result is greater than 255).
• A DIV instruction causes a divide-by-zero condition.
The OV bit is cleared to 0 by the ADD, ADDC, SUBB, MUL, and DIV instructions in all other cases
UD User definable flag: This is a bit-addressable, general purpose flag for use under software control.
P Parity flag; P=1 for Odd no. of 1’s; P=0 for Even no. of 1’s
Accumulator: It is used as a general register to accumulate the results of a large number of instructions.
It can hold an 8-bit (1-byte) value and is the most versatile register
The Register A is located at the address E0H in the SFR memory space.
Register A and Register B. Register A serves as an accumulator while Register B functions as a general purpose
register. These registers are used to store the output of mathematical and logical instructions.