You are on page 1of 22

BITS Pilani

presentation
BITS Pilani Dr Ramani Kalpathi
Automotive Electronics
Pilani Campus
BITS Pilani
Pilani Campus

AELZG512, Embedded System Design


Lecture No. 1
Introduction to Embedded Systems

Introduction
Characteristics, classification-Embedded System
Hardware Components of Embedded System
Introduction to 8-bit Processor Architectures
Basic peripherals like I/O, ADC, PWM, Timers , ADC,
Interrupts, Typical interfaces
Software components of Embedded System
Design with 8-bit PIC Controllers, IDE, Build Process,
Simulators, C and Assembly

BITS Pilani, Pilani Campus


Prerequisites – Number Systems
Binary (8 bit) Hexadecimal Decimal
0000 0001 0x01 1
0000 0010 0x02 2
0000 0011 0x03 3
0000 0100 0x04 4
0000 0101 0x05 5
0000 0110 0x06 6
0000 0111 0x07 7
0000 1000 0x08 8
0000 1001 0x09 9
0000 1010 0x0A 10
0000 1011 0x0B 11
0000 1100 0x0C 12
0000 1101 0x0D 13
0000 1110 0x0E 14
0000 1111 0x0F 15
0001 0000 0x10 16
0001 0001 0x11 17….. And so on
BITS Pilani, Pilani Campus
Embedded Systems
Wiper Systems

BITS Pilani, Pilani Campus


Microcontrollers in embedded
systems
• Microcontrollers are interconnected along with discrete
devices and sensors to form the hardware part of the
embedded system.
• The intelligence for the embedded system is the
software program that is loaded into the memory of the
microprocessor peripherals.
• Electronic Throttle controller, Power steering controller,
engine management system, windshield wiper systems
are examples

BITS Pilani, Pilani Campus


Characteristics

Specific Function: A steering systems primary function of taking inputs


from the steering wheel and translating the same into actuator
Constraints: Size, cost , performance
Real Time System: Interact with environment in real time to adjust
performance
Reliability: Repeatable fail-safe performance
Complex Algorithms: Computational and logic capability

BITS Pilani, Pilani Campus


Types of Memory

OTPROM –
One Time Programmable
Read Only memory
8051 architecture
-Cheapest

EPROM –
Electrically Programmable
Read Only Memory
(needs to be erased by
UV light)
BITS Pilani, Pilani Campus
Memory Types

EEPROM
Electrically Erasable Programmable
Read Only Memory
( 24LC256)

RAM (SRAM,DRAM) – Random Access Memory


Flash memory – Writeable using fast flash operations

BITS Pilani, Pilani Campus


Microcontroller
PIC – Input-Output Interface

BITS Pilani, Pilani Campus


Output operations
//PORTD pins – RD7, RD6, RD5, RD4, RD3,RD2,RD1,RD0
//Make LEDs on PORTD pins RD0 and RD7 blink one after another
void main()
{
TRISC = 0x00; //Make all pins as output direction
while(1)
{
PORTD = 0x01; // 0000 0001 makes RD0 high
delay_ms(1000); // one second delay
PORTD = 0x80; // 1000 0000 makes RD7 high
delay_ms(1000); // one second delay
}
}

BITS Pilani, Pilani Campus


Input Operations
Sound the buzzer when a switch is depressed

unsigned char switchstatus; //Declare a byte variable


void main()
{
TRISB = 0xFF; //PORTB pins as input
TRISC = 0x00; //PORTC pins as output direction
while(1)
{
switchstatus = PORTB & 0x08; //Read RB3 logic
if (switchstatus) PORTC = 0x20; //Turn ON buzzer
else PORTC = 0x00;
delay_ms(1000); // one second delay
}
}
// PORTB = xxxx1xxx when key is released, xxxx0xxx when key pressed
//PORTC = 0010 0000 to turn ON buzzer
BITS Pilani, Pilani Campus
Assembly Language Program

BITS Pilani, Pilani Campus


Interrupts in PIC 16F877A
Interrupts are branches in code execution triggered by hardware events or
software events. Interrupt vector location is 0004h. Program counter that
points to execution of next instruction will now point to interrupt vector to
execute a subroutine specific to the source of the interrupt.
There are totally 11 sources for interrupts
• T0I Timer0
• TMR1I Timer1 timer overflow interrupts
• TMR2I Timer2
• INT (Pin RB0) External interrupts
• RBI (RB4-RB7)
• RC1 Receiver USART interrupts
• TX1 Transmitter
• CCP1I Capture/Compare/PWM
• ADI Analog to digital conversion
• PSPI parallel Slave Port
• EEI EEPROM
BITS Pilani, Pilani Campus
Peripherals- I/O, Timers, ADC,
EEPROM, PWM
Special Function registers are provided for activating each
peripheral – Refer Datasheet
Input/output ports – Pins used to turn ON, turn OFF, read
logic high or low levels – Used for controlling relays,
transistors, display devices, read switches, digital
sensors
Timer/Counter – Peripheral used to count events, find time
between events, schedule events, provide periodic time
intervals for program scheduling
PWM – Pulse width modulation – generate waveforms with
variable ON time, constant period pulses

BITS Pilani, Pilani Campus


ADC, DAC, Serial

ADC – Analog to Digital Converter is a peripheral used to convert the


instantaneous value of a time varying analog signal to a binary number.
For example a 8 bit analog to digital converter will convert a 2.5V signal
to 1000 0000 (128 in decimal) and a 5V signal input to 1111 1111 (255 in
decimal). These peripherals are used in most measurement and control
applications.
DAC – Digital to Analog Converter is a peripheral used to convert digital
value to analog value. These peripherals are used for waveform
generation applications for example.
Serial Ports –Microcontrollers use serial peripherals to transfer data using a
minimal number of connections by transmitting data one bit after another.

BITS Pilani, Pilani Campus


Software Design Flow

*Rajkamal, Embedded Systems


BITS Pilani, Pilani Campus
Real Time Operating Systems

A real-time operating system (RTOS) is an operating system


(OS) intended to serve real-time application process data as
it comes in, typically without buffering delays. Key factors in
an RTOS are minimal interrupt latency and minimal thread
switching latency. An RTOS is valued more for how quickly
or how predictably it can respond than for the amount of
work it can perform in a given period of time.
For embedded devices, the general rule is that an RTOS is
used when the application needs to do more than a few
simple actions. An RTOS allows an application to be
structured in a manner that scales as more
application/system features are added (e.g. communication
stacks, power management, etc.).
BITS Pilani, Pilani Campus
RTOS Goals

Small latency: Minimum delay time from one task to another.


Determinism: Time taken for execution of a task or thread
needs to be predictable so that deadlines are known.
Structured Software: Software tasks can be organized, added
or deleted based on the system requirement.
Scalability: RTOS must be able to scale from a simple
application to a complex one with stacks, drivers, file
systems.
Offload development: An RTOS manages many aspects of the
system which allows a developer to focus on their
application. For example an RTOS, along with scheduling,
generally handles power management, interrupt table
management, memory management, exception handling.
BITS Pilani, Pilani Campus
System On Chip

A system on a chip (SoC) is an integrated circuit that


integrates all components
A CPU, memory, GPIO and secondary memory are placed on a
single substrate or microchip.
Digital logic, analog circuits, mixed signal and radio frequency
circuits may be added into the single substrate.
SOC devices consume less power, less area and are much
smaller than multi-chip designs.
SoCs are common in the Smartphone applications, Internet of
things applications.

BITS Pilani, Pilani Campus


Questions (Use PIC 16F877A
datasheet for reference)
1. What is the program counter?
2. What is stack in microcontroller?
3. Where is the program stored; where are the program
variables stored?
4. What is the width of program counter in PIC16F877A?
5. What is the size of flash memory in PIC16F877A?
6. What is a watchdog timer?
7. Differentiate the operations of timer and counter.
8. Can you write a code sample to read two switches and
light up two LEDs to determine which switch is
pressed?

BITS Pilani, Pilani Campus


Software and Tools

1. Download Mikro-C Pro or MikroC for PIC Controllers


from www.mikroe.com
https://www.mikroe.com/mikroc-pic
2. Download PICSIMLAB software for simulating
embedded systems on your PC
(Use PIC16F877A controller – Board 4)

BITS Pilani, Pilani Campus

You might also like