Professional Documents
Culture Documents
SYSTEMS
By Melaku M.
Definition
12
Design Metrics
• Common metrics
• Unit cost: the monetary cost of manufacturing each copy of the
system, excluding NRE cost
• NRE cost (Non-Recurring Engineering cost): The one-time
monetary cost of designing the system
• Size: the physical space required by the system
• Performance: the execution time or throughput of the system
• Power: the amount of power consumed by the system
• Flexibility: the ability to change the functionality of the system
without incurring heavy NRE cost
Cont…d
• Time-to-prototype: the time needed to
build a working version of the system
• Time-to-market: the time required to
develop a system to the point that it can be
released and sold to customers
• Maintainability: the ability to modify the
system after its initial release
• Correctness, safety, many more
Input and output technology
• A sensor converts some physical
characteristics of its environment into
electrical signals
Examples of sensor
• Photo-voltaic sensor
• Temperature sensor
• Pressure sensor
Actuators
Examples of actuators
• Motors
• Heaters
• Hydraulic and pneumatic actuators
Processors
Microprocessors and Micro-Controller
Key requirement:
• Energy Efficiency
• High code density
Microprocessors
CPU for computers
No RAM, ROM, I/O on CPU chip itself
Example: Intel’s x86, Motorola’s 680x0
Data Bus
CPU
General Serial
purpose RAM ROM I/O Port Timer
port
Microproce
ssor
Address Bus
Microcontroller
A micro-controller is a single silicon
chip device which integrates a number
of the components of a microprocessor
system onto a single microchip.
• The CPU core
• Memory (both ROM & RAM)
• Some parallel digital I/O & more
Components of a Micro-controller
A timer module to allow the micro-
controller to perform tasks for
certain time period.
A serial I/O port to allow data flow
b/n the micro-controller and other
devices.
Components of a Micro-controller
Data Memory
Program Memory
Access to both memories is possible in
each cycle b/c of the distinct buses.
27
The PIC Family: Program Memory
EPROM (Erasable Programmable Read
Only Memory)
• One Time Programmable (OTP) chips are
EPROM chips, but with no window.
FLASH
• Re-writable
• Much faster to develop
28
The PIC Family: Program Memory
Mid-range PIC processors have 13 bit
program counter.
Width of program memory bus is 14
bits.
Program memory space divided into 4
pages of 2k each.
29
Memory Map
30
Stack
31
The PIC Family: Data Memory
PICs use general purpose “file
registers” for RAM (each register is 8
bits for all PICs)
32
Interrupts
• An interrupt is any service request that
causes the CPU to stop its current
execution stream & to execute an
instruction stream that
services/generates the interrupt.
Interrupts
35
PIC Peripherals: Digital I/O
All PICs have digital I/O pins called ports.
Ports are used to control & monitor external
devices as a source.
different processors.
• Readability
basic structure of an Embedded C Program
Multiline Comments . . . . . Denoted using /*……*/
Single Line Comments . . . . . Denoted using //
Preprocessor Directives . . . . . #include<…> or #define
Global Variables . . . . . Accessible anywhere in the program
Function Declarations . . . . . Declaring Function
Main Function . . . . . Main Function, execution begins here
{
Local Variables . . . . . Variables confined to main function
Function Calls . . . . . Calling other Functions
Infinite Loop . . . . . Like while(1) or for(;;)
Statements . . . . .
….
}
Function Definitions . . . . . Defining the Functions
{
Local Variables . . . . . Local Variables confined to this Function
Statements . . . . .
….….
}
Configuring PIC16F877A
• Every pin has its own name
• A pin can be declared as input or output
• Pin declaration:
• TRISB.B6=1/0; //1 for input device 0 for
output device
• PORTB.B6 = 1/0;
EX: Interfacing & controlling an LED
• Define a pin of a controller for the LED to be
connected
command: trisc.b0=0;//LED is output device
• Tell the controller to send a high voltage to its
pin where the LED is connected which is port
C pin number 0
command: portc.b0=1;
Write a code for the following schematic diagram.
• double temp,temp1;
• void main() { • else {
• trisa.b0=1;//sensor • portb.b2=0;
• trisb.B1=0;//fan • portb.b3=0;
• trisb.B2=0;//heater • portb.b1=0; }
• trisb.B3=0;//buzzer • if(temp1>=30) {
• portb.b3=0; • portb.b1=1;
• portb.b1=0; • portb.b3=0;
• portb.b2=0; • portb.b1=0; }
• while(1){ • else {
• temp=adc_read(0); • portb.b2=0;
• temp1=0.488*temp; • portb.b3=0;
• if(temp1<10){ • portb.b1=0; }
• portb.b2=1; • if(temp1>=40) {
• portb.b3=0; • portb.b2=0;
• portb.b1=0; } • portb.b3=1;
• else { • portb.b1=1; }
• portb.b2=0; • else {
• portb.b3=0; • portb.b2=0;
• portb.b1=0; } • portb.b3=0;
• if((temp1>=10) && (temp1<30)) { • portb.b1=0; } } }
• portb.b2=0;
• portb.b3=0;
• portb.b1=0; }