0% found this document useful (0 votes)
3 views

Lecture 1

Embedded system

Uploaded by

Omar Alwaqa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lecture 1

Embedded system

Uploaded by

Omar Alwaqa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

‫بسم الله الرحمن الرحيم‬

Embedded System And


Interface

LECTURE 1

Microcontroller
Prepared by Dr. Mahmoud Qaid

1
Outlines
• Types of Microcontroller
• What is Arduino?
• Arduino Board Variants
• Components of an Arduino Board
• Arduino Programming
• Arduino Programming Basics
• LED Blinking
• Read from Sensor
2
Closed loop embedded system

3
Types of Microcontroller
Microcontrollers come in various types, each designed for specific
applications and requirements. The commonly microcontroller types:
• 8-bit Microcontrollers: These have 8-bit data bus and are widely used
in simple, low-cost applications where processing power and memory
requirements are minimal. Examples include the Atmel AVR,
Microchip PIC, and Texas Instruments MSP430 series.
• 16-bit Microcontrollers: these offer improved performance and larger
memory compared to 8-bit. They are suitable for applications that
require more computational power and memory, such as industrial
control systems and automotive applications. Examples include the
Microchip PIC24 and Renesas RL78 families.
4
Types of Microcontroller
• 32-bit Microcontrollers: These microcontrollers provide even higher
performance, larger memory capacity, and enhanced peripherals. They
are commonly used in applications that demand more processing
power, such as advanced robotics, consumer electronics, and medical
devices. Examples include the ARM Cortex-M series (e.g., STM32,
NXP LPC, and Silicon Labs EFM32) and Renesas RX series.
• 64-bit Microcontrollers: While less common, 64-bit microcontrollers
are used in specialized applications that require extremely high
processing power and memory, such as high-end networking
equipment, servers, and complex data processing systems. Examples
include the ARM Cortex-A series and Intel Quark.
5
What is Arduino?
• Arduino is an open-source electronics
platform based on easy-to-use hardware and
software.
• It consists of a microcontroller board (the
hardware) and an integrated development
environment (IDE) for programming the
board.
6
Arduino Board Variants
1. Arduino Uno: The most common and widely used Arduino
board, suitable for beginners and intermediate users.
2. Arduino Mega: Provides more input/output pins and memory
for larger projects.
3. Arduino Nano: A compact version of Arduino Uno, suitable for
projects with space constraints.
4. Arduino Due: Features a more powerful microcontroller and is
ideal for projects requiring high computational power.
* There are many other variants available, each with its own unique
features and capabilities.

7
8
Components of an Arduino Board
1. Microcontroller: The brain of the board responsible for executing
the program and controlling external devices.
2. Digital and Analog Input / Output (I/O) Pins: Used to interface with
external devices such as sensors, actuators, LEDs, etc.
3. Power Supply: Arduino boards can be powered via USB, external
power sources, or batteries.
4. USB Port: Used for programming the board and establishing serial
communication with a computer.
5. Reset Button: Allows you to restart the program execution on the
board.
9
Arduino Programming

• Arduino IDE: A user-friendly software used to write, compile, and


upload programs (sketches) to the Arduino board.
• Sketch Structure: Consists of two essential functions - setup() and

loop( ).
• setup( ): Runs once when the board initializes, used for initializing
variables, configuring pins, etc.
• loop( ): Runs repeatedly after setup(), the main program execution
occurs here.

11
Arduino Programming

12
Arduino Programming Basics
• Variables: Used for storing data such as numbers, text, or
sensor readings.
• Control Structures: If-else statements, for/while loops, and
switch-case statements for decision-making and repetition.
• Functions: Reusable blocks of code for performing specific
tasks.
• Libraries: Pre-written code that extends the functionality of
Arduino, e.g., for LCD displays, sensors, motor control, etc.

13
LED Blinking
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off
delay(1000); // wait for a second
}
14
15
Read from Sensor
#include <LiquidCrystal.h>
int sensorValue = 0; // variable to store the value coming from the sensor
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Temperature");
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(A0);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
lcd.print(sensorValue);
}
16
17

You might also like