ESD All Units
ESD All Units
8-bit microcontroller, based on Harvard architecture (separate program and data memories).
It consists of:
Mainly used in devices requiring dedicated control operations like washing machines, microwave ovens,
etc.
2. 8051 Architecture
CPU: Manages operations, has ALU, Accumulator (A), B register.
Timers/Counters: Two 16-bit timers for measuring time and event counting.
I/O Ports:
Special Pins:
4. Memory Organization
Program Memory (ROM):
Located from 80H to FFH for controlling hardware like timers, serial communication, ports.
5. Addressing Modes
Immediate Addressing: Operand given directly. (e.g., MOV A, #55H)
Indexed Addressing: Accessing program memory using DPTR and A. (MOVC A, @A+DPTR)
7. Overview of Arduino
Arduino is an open-source platform for developing interactive electronics projects.
Arduino uses its own IDE (Integrated Development Environment) for programming in simplified C++.
Features:
2KB SRAM
1KB EEPROM
10-bit ADC
Reset button.
1. setup()
➤ Explanation:
Called once when the program starts.
Used to initialize pin modes, start serial communication, and initialize libraries.
✅ Important:
Without a proper setup() , the hardware might not function correctly.
➤ Example Program:
void setup() {
pinMode(13, OUTPUT); // Set pin 13 as output
}
void loop() {
// Nothing here for now
}
2. loop()
➤ Explanation:
Continuously executes after setup() .
✅ Important:
If you want repeated tasks (e.g., blinking an LED), place them in loop() .
➤ Example Program:
void loop() {
digitalWrite(13, HIGH); // Turn LED ON
delay(1000); // Wait for 1 second
digitalWrite(13, LOW); // Turn LED OFF
delay(1000); // Wait for 1 second
}
3. digitalRead(pin)
➤ Explanation:
Reads a digital input pin: returns either HIGH or LOW .
✅ Important:
Before using digitalRead() , set the pin as INPUT with pinMode() .
➤ Example Program:
int buttonPin = 2;
int ledPin = 13;
int buttonState = 0;
void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH); // Turn ON LED
} else {
digitalWrite(ledPin, LOW); // Turn OFF LED
}
}
➤ Explanation:
Sets a digital output pin to HIGH (5V) or LOW (0V).
✅ Important:
The pin must be set as OUTPUT before using digitalWrite() .
➤ Example Program:
void setup() {
pinMode(8, OUTPUT);
}
void loop() {
digitalWrite(8, HIGH); // Turn ON LED
delay(500);
digitalWrite(8, LOW); // Turn OFF LED
delay(500);
}
5. analogRead(pin)
➤ Explanation:
Reads an analog input value between 0 to 1023.
✅ Important:
The value is proportional to input voltage (0–5V for UNO).
➤ Example Program:
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
6. analogWrite(pin, value)
➤ Explanation:
Generates PWM (Pulse Width Modulation) signal.
Value between 0 (0% duty cycle) and 255 (100% duty cycle).
✅ Important:
Only specific pins (like 3, 5, 6, 9, 10, 11 on UNO) support analogWrite() .
➤ Example Program:
int ledPin = 9;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
analogWrite(ledPin, 255); // Full brightness
delay(1000);
analogWrite(ledPin, 128); // Half brightness
delay(1000);
analogWrite(ledPin, 0); // LED OFF
delay(1000);
}
1961:
1970s:
Today:
Embedded systems are integrated with IoT, Artificial Intelligence, and Smart Devices.
First Generation:
8-bit microcontrollers (simple devices).
Second Generation:
16-bit processors, better performance.
Third Generation:
Fourth Generation:
B. Based on Complexity:
D. Based on Triggering:
Home Appliances:
Microwave ovens, Refrigerators, Washing Machines.
Automotive:
Industrial Automation:
Healthcare:
Medical instruments like ECG, infusion pumps.
Telecommunications:
Routers, Mobile base stations.
Banking:
ATM machines, Smart Card readers.
Data Communication:
Transfer data between systems (e.g., Wi-Fi modules).
Controlling Devices:
Activate actuators based on sensed inputs (e.g., Air conditioners adjusting temperature).
User Interface:
Accept commands and display responses (e.g., ATM touch screen).
Single Functionality:
Reliability:
Must work continuously and correctly.
Compact Size:
Small, portable, and integrated.
Quality Attributes:
Operational Quality:
Response time
Reliability
Throughput
Maintainability
Security
Non-Operational Quality:
Testability
Portability
Scalability
✅ Tip:
Always remember — Embedded systems are designed for efficiency, reliability, and specific functionality.
It mainly includes:
✅ Key Tip:
Core = Processor + Memory + I/O Devices + Software.
Microcontrollers (MCUs):
Microprocessors (MPUs):
B. Domain-Specific Processors:
✅ Tip:
Microcontroller = CPU + RAM + ROM + I/O ports together.
Types:
✅ Tip:
PLDs are flexible and cost-effective for small production volumes.
Used when very high performance and compact size are required.
Example:
✅ Tip:
ASICs are optimized for speed, power efficiency, and miniaturization.
Examples:
✅ Tip:
COTS = "Buy and Use" components for faster development.
Devices that sense physical conditions and convert them into electrical signals.
Examples:
B. Actuators:
Devices that convert electrical signals into physical actions (motion, heat, sound).
Motors
Heaters
Buzzers
✅ Tip:
Sensor = Senses input; Actuator = Produces output.
Master-slave structure.
D. Parallel Interface:
✅ Tip:
I2C = 2 wires (slow),
A. RS232:
C. Infrared (IRDA):
Used in TV remotes.
D. Bluetooth:
E. Wi-Fi:
F. ZigBee:
✅ Tip:
RS232, USB = wired.
📚DEVELOPMENT
UNIT-4: EMBEDDED FIRMWARE DESIGN AND
Disadvantages:
Enhancements:
Advantages:
Disadvantages:
✅ Tip:
Use Super Loop for simple projects, and Embedded OS for complex, real-time embedded applications.
Advantages:
Disadvantages:
Advantages:
Disadvantages:
✅ Tip:
Today, most firmware is developed in C language because it balances control and ease.
Step-by-Step Process:
1. Write Source Code:
Use an assembler (e.g., A51) to convert .asm file into .obj file.
Hex file is a machine-readable file that can be loaded into the microcontroller.
✅ Tip:
Final Hex file contains the machine code for programming the microcontroller.
Drawbacks:
Difficult to understand, write, and debug.
Advantages:
Faster application development.
Drawbacks:
May produce less optimized machine code.
Used when:
Types of Mixing:
A. Mixing Assembly into High-Level Language:
Assembly code can be written inside a C program using special syntax (inline assembly).
Example in C:
✅ Tip:
Critical code (like Interrupts) can be written in Assembly, and the rest of the application in C.
Overview:
Assembly Language is low-level, hardware-specific programming.
Written using mnemonics (e.g., MOV , ADD , SUB ) directly understood by the microcontroller.
Features:
2. Assemble:
3. Link:
4. Object to Hex:
5. Burn to ROM:
Addressing Modes:
Immediate
Register
Direct
Indirect
Base Index
✅ Tip:
Always end the program with the END directive.
Example Programs:
CLR C
MOV A, R4
SUBB A, R6
MOV 20H, A
MOV A, R5
SUBB A, R7
MOV 21H, A
C. Multiplication:
ORG 00H
MOV A, 51H
MOV B, 52H
D. Division:
MOV A, R0
MOV B, R1
DIV AB
MOV R2, A ; Quotient
MOV R3, B ; Remainder
ORG 00H
MOV A, #38H
ACALL COMNWRT
ACALL DELAY
MOV A, #0EH
ACALL COMNWRT
ACALL DELAY
MOV A, #'N'
ACALL DATAWRT
ACALL DELAY
MOV A, #'O'
ACALL DATAWRT
AGAIN: SJMP AGAIN
Subroutines:
✅ Tip:
Use Look-Up Table (LUT) to convert key press into display output.
3. Embedded C Programming
Overview:
Embedded C extends standard C to control hardware devices.
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
setColor(255, 0, 0); delay(1000);
setColor(0, 255, 0); delay(1000);
setColor(0, 0, 255); delay(1000);
}
void setup() {
lcd.begin(16,2);
lcd.print("Hello World!");
lcd.setCursor(0,1);
lcd.print("LCD Tutorial");
}
void loop() {}
int buttonState = 0;
int ledPin = 13;
int switchPin = 2;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(switchPin, INPUT);
}
void loop() {
buttonState = digitalRead(switchPin);
if(buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
void setup() {
pinMode(buzzer, OUTPUT);
}
Overview:
Arduino uses UART for Serial Communication.
Basic Functions:
Serial.begin(baudrate)
Serial.print()
Serial.println()
Serial.read()
Serial.available()
Example Programs:
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("Hello World");
delay(1000);
}
int incomingByte = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
int pushButton = 2;
void setup() {
Serial.begin(9600);
pinMode(pushButton, INPUT);
}
void loop() {
int buttonState = digitalRead(pushButton);
Serial.println(buttonState);
delay(100);
}
✅ Tip:
Use Serial Monitor in Arduino IDE to view sent and received data.