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

Embeddeddd

This document provides an overview of embedded systems, including: - Embedded systems are computers customized for specific tasks, ranging in size from flashlights to airplanes, and often use microcontrollers. - Communication protocols for embedded systems include serial protocols like RS-232 and I2C, and parallel protocols like PCI. - Analog signals are converted to digital with analog-to-digital converters (ADCs) and digital signals are converted to analog with digital-to-analog converters (DACs). Common ADC types include flash ADCs, ramp compare, and successive approximation. - Additional topics covered include number systems, buttons/switches, breadboards, prototyping techniques like soldering, and embedded

Uploaded by

valii_k
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Embeddeddd

This document provides an overview of embedded systems, including: - Embedded systems are computers customized for specific tasks, ranging in size from flashlights to airplanes, and often use microcontrollers. - Communication protocols for embedded systems include serial protocols like RS-232 and I2C, and parallel protocols like PCI. - Analog signals are converted to digital with analog-to-digital converters (ADCs) and digital signals are converted to analog with digital-to-analog converters (DACs). Common ADC types include flash ADCs, ramp compare, and successive approximation. - Additional topics covered include number systems, buttons/switches, breadboards, prototyping techniques like soldering, and embedded

Uploaded by

valii_k
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Embedded Systems

Detour: Number Systems

Humans work in Base Ten (Decimal)

Each digit is 0!" each #lace is $0%#lace

&om#uters work in Base Two (Binary)

Each digit is 0 or $" each #lace is '%#lace

(ost de)ices use *Two+s &om#liment, which allows -or


signs with only the two symbols.

Decimal/-ractional numbers are usually re#resented as


0loating 1oint Numbers (*0loats,) that use se)eral
number -ields

2-ten He3adecimal (He3 4 Base $5" symbols 00) or


2ctal (Base 6" symbols 07) are used as a
com#romise

Embedded Systems

&om#uters" customi8ed -or a s#eci-ic task

9ange in si8e and com#le3ity -rom -lashlights to


air#lanes.

(ost o-ten" (icrocontrollers

0i3ed (emory" 9:(" &1; and </2 on one chi#.

2ther -la)ors:

:S<&

01=:/1rogrammable >ogic

DS1

Single Board &om#uters

S#ecial 0unction &om#uters



History

D$7 &om#uter ((inuteman (issiles) in $!5$

:#ollo =uidance &om#uter in $!55

<ntel ?00? Single&hi# &1; in $!7$

T< T(S $000 in $!7$$!7?

1owers the S#eakandS#ell

:tmel and (icrochi# introduce #rogrammable


models in $!!@.

D$7 D$7
?00? 1ackage
?00? (ask
T(S$000

:natomy

:ttached to something to (onitor and/or


&ontrol

>ess usermodi-iable

;sually less #ower-ul

(any embedded com#uters #er recogni8able


com#uter.

<ncluding se)eral <NS<DE the com#uter.

S&:D: 4 Su#er)isory Control And Data


AcAuisition

(icrocontroller 0amilies

2rder o- '0 common -amilies in circulation

(any more obscure designs around.

(any are closely related to or directly


descended -rom *0ull, com#uters.

6Bit micros make u# about hal- the &1;s sold


e)ery year.

6Bit

60B$ 4 Since $!60" but direct descendent o-


<ntel+s (&S?6 -rom $!75.

1<& *1eri#heral <nter-ace &ontroller,


ubiAuitous" around since $!7B.

56H&$$ 4 u& cousin o- the (otorola 5600 -rom


$!6B.

C60 4 0ancier <ntel 6060" same #arent as 365


1&s.

:D9 4 :tmel+s line -rom $!!5" descendent o-


Norweigan college students+ design.

$5 and @' Bit

(S1?@0 4 T< $5bit design" -rom the $!!0s" like


a 1D1$$.

:9( 4 Designed -or 1&s in $!67" good -or


mobile" licensed to e)eryone.

&old0ire 4 (otorola 56E+s embedded )ariant.

F65 Embedded Boards



:rduino

1roGect started in <)rea" <taly in '00B

Based on earlier 1rocessing and Hiring #roGects.

E--ort to make u&s accessible to hobbyists"


artists" and other nonengineers.

Based on an :D9 :T(ega6 -amily #art

&II like language" Ja)a <DE

=reat -or ra#id #rototy#ing




>EDs

>ight Emitting Diode

9eAuires a &urrent >imiting 9esistor



Embedded De)elo#ment Two
1utting 1arts Together

Breadboard

Each numbered row is


connected internally" u# to the
middle se#arator.

Each marked Bus &olumn is


connected internally

Sometimes s#it in the middle

D<1 <&s straddle the middle

=ood -or #rototy#ing" bad -or


reliability and sensiti)e signals.

Breadboard Best 1ractices

Neatness &ounts. : lot.

&olor &ode wires

;se wires o- a##ro3imately the correct length

Start with <&s 4 always orient them the same way

Then add #ower and ground

Then add internal connections

Then add chi#tochi# connections

Then e)erything else

Ta#e -lags and other labels are your -riend



Now HhatK

Breadboards are e3#ensi)e" laborintensi)e" bulky" and -ragile.

Hire Hra#

2ut o- )ogue" #ointto#oint wired on long #ins

1er-board

:ccessible and ;ni)ersal

Not re#eatable" error #rone

1rinted &ircuit Boards

Design with &:D so-tware" like gED: and E:=>E


Send away
;se co##erclad with #rinter or #hoto trans-er and chemical baths.
2r" a mill it

Hobby tool called 0rit8ing



E3am#les

Hire Hra#

Household Etching

1er-board D. 1&B

Buttons and Switches

: sim#le button Gust makes or breaks a


connection

Need some kind o- reliable binary on/o--

;nconnected #in L ;nknown )alue

1ull a signal between Dcc and =nd

Dead 8one between $ and 0 )oltage *Hysteresis,

1ullu# and 1ulldown 9esistors

(any kinds o- switch



Buttons and Switches (cont+d)

S1ST

Single1ole Single
Throw

S1DT

Single1ole" Double
Throw

N&/N2 Normally Connected / Normally O#en



1ullu# and 1ulldown

<ntegrated 1ullu#s

(any de)ices" es#ecially microcontrollers" ha)e


builtin #ullu# resistors

Enable in so-tware when setting u# a #in/#ort

2n an :rduino" the -ollowing code will #ull u#


an in#ut #in.
pinMode(pin, INPUT); // set pin to input
digitalWrite(pin, HIGH); // turn on pullup
resistors

Switch Bounce

0li##ing a switch or #ressing a button doesn+t


make a single clean transition

9ead too -ast" get the wrong )alue

E3tra e)ents on *when the switch changes,


Switch bounce image courtesy o- (a3im Semiconductor

Handling Bounce

Hardware (ethods

9& &ircuit

>atch

(onostable
multi)ibrator

Timer

State machine

&ommon -actor:
9eAuire additional
#arts.

So-tware (ethods

0i3ed Delay

Timer/&om#arator

Debouncing on the :rduino
int val;
int val2;
int buttontate;
void loop()!
val " digital#ead(s$it%&Pin);
dela'(());
val2 " digital#ead(s$it%&Pin);
i* (val "" val2) !
//+%t on Input &ere
E3am#le -rom >ady:da.net :rduino Tutorial
Alternative technique example at:
http://www.arduino.cc/en/Tutorial/Debounce

&ommunication

(ain &hoices:

Serial )s. 1arallel

Serial reAuires -ewer #ins

1arallel allows more data #er action

Di--erent decoding reAuirements

Synchronous )s. :synchronous

:synchronous reAuires a start/sto# symbol

Synchronous reAuires a se#arate sync signal



1arallel 1rotocols

Bundles o- Discrete
>ogic Signals

2ne Hot/Encoded
symbols

<EEE $'6? 1&


1arallel 1ort

1&< (not e3#ress)



Serial 1rotocols

&hea#er to im#lement (&ables and


transcei)ers)

>ess susce#tible to inter-erence

&rosstalk" &lock Skew

S#eed issue:

2nly one bit mo)ed at a time

&om#le3ity 2-ten discussed )ia Hire &ount

!wire" Bwire ?wire" @wire" 'wire and $wire


common

&ommon 1rotocols

9S'@'

0rom $!5'

&om#liant designs must handle M'BD

(ost don+t" and run at @.@D or BD

S1< (*0our Hire,)

Built in to many u& designs" including :tmega6

<'& (*Two Hire,)

S(Bus (com#uter sensors) is a subset

$Hire

2nly one wire and a ground connection



9S'@'

2#tion con)entions

S#eed: $'00" '?00" ?600" !500" $??00" $!'00"


@6?00" B7500 and $$B'00 bit/s

(Data/1arity/Sto#)

Data: Number o- data bits #er -rame" B"5"7" 8 or !

1arity : None" Odd" )en" !ark" or S#ace

Sto#: Number o- sync bits at end o- -rame (usually $)

0low &ontrol

9TS/&TS" DT9/DS9 (using wires)

F2N/F200 (esca#ed Signals)

None or Higher >e)el



<'&/TH<

Dery #o#ular -or small" low #ower board integration

;# to $$' De)ices

2ne master" switchable at any time

$00Ebit/s low #ower mode" u# to @.?(bit/s high s#eed


mode

Single Ended

2ne Hire signals" one wire carries re-erence

&lock Stretching

:ny sla)e de)ice can hold the clock until it is ready to res#ond

:rduino

Has S1< and 9S'@' Su##ort

&ommunication between the :rduino and 1&


are )ia 9S'@' !500 (6/N/$)

Bridged -rom ;SB with 0TD< 0T'@'9> or


#rogrammed :Tmega6;'

Serial library is always included

Serial.begin(!500)N in setu#

Serial.#rintln()N to write

Ha)e to Oinclude PS1<.hQ -or S1< su##ort



Homework

Hrite a sketch that correctly counts the number


o- times a button attached to the :rduino has
been #ressed" and #rints it to the serial monitor.

Bring a co#y o- your code to turn in ne3t week.



:nalog </2
Datasheets

Digital De)ices" :nalog Horld

:nalog L &ontinuous Time" &ontinuous Dalue

Digital L Discrete Time" Discrete Dalue

(icrocontrollers" like all modern com#uters" are


digital de)ices.

The world is an analog #lace

<n#ut: :nalog to Digital &on)erters (:D&)

2ut#ut: Digital to :nalog &on)erters (D:&)



Terminology

9ange

The s#ectrum o- )alues a de)ice can manage


;sually Dolts" ;sually limited usercon-iguration
Hatch limits: BD to IBD is not the same as 0$0D

9esolution

The number o- discrete le)els a de)ice can encode


2-ten Auoted in Bits

EAui)alently: The smallest change the de)ice can detect/#roduce


2-ten Auoted in Dolts/Di)

9ate

How -ast/o-ten the signal is sam#led


(ust be twice as -ast as the -astest signal to be sam#led (NyAuist4
Shannon sam#ling theorem)

Terminology" contd.

Signaltonoise

The relati)e si8e o- the desired signal to


background signals
2-ten Auoted in dB 4 $0Rlog
$0
()alue)

>inearity

(ost :D&s designed so each ste# is the same si8e

Non>inearity measures the de)iation -rom that ideal

Some :D&s are intentionally nonlinear



Einds o- D:&

9'9 9esistor >adders

Thermometercoded D:&

Doltage source #er out#ut )alue

Turn on the closest match

DE9S e3#ensi)e

(ost D:& is accom#lished with 1H(

1H( 4 1ulse Hidth (odulation

9eAuires only one #in" and a timer



1H(

&arrier 0reAuency

>imiting -actor: &ounter


resolution

0ilter to smooth out the


#ulses

(any de)ices reAuire


no -iltering

>ights ha)e 1ersistence


o- Dision

(otors ha)e <nductance


<mage courtesy o- :rduino.cc

Einds o- :D&

:bout a do8en common )arieties

Tradeo-- between com#le3ity and S#eed

(any designs use a D:&" and a &om#arator to


iterati)ely match the in#ut

Design goal: >owest su--icient resolution

:)ailable as discrete com#onents

;sually builtin to u&s" included in some


sensors.

0lash :D&

>arge bank o- com#arators

Tests against each #ossible


encoded )alue

The closest match is selected

'
N
4 $ com#arators -or N bits o-
resolution

E3tremely -ast

E3tremely e3#ensi)e

Hard to manu-acture

SubGect to noise

=enerally low resolution



9am# &om#are

;ses a D:& to create a com#arison signal

Single com#arator continuously com#ares in#ut


to generated signal

9e#eatedly *ram#s, D:& o)er the range

9ecords D:& )alue when signals match


<mage -rom htt#://www.allaboutcircuits.com/)olT?/ch#tT$@/B.html

Successi)e :##ro3imation

1er-orms a binary search o-


the range with a D:& and
com#arator

Set -irst bit to $N generate )alue


on D:&N com#are.
<- D
in
PD
dac
" reset to 0N else" kee#
bit as $

9e#eat -or ne3t bit

Turn on E2& when match


achie)ed

Slow" but relati)ely sim#le and


#rotected -rom errors

:rduino

:nalog9ead()

Successi)e :##ro3imation :D&

5 channels" $0bit resolution" $0kH8

Builtin :9E0

analog9e-erence(ty#e)

Ty#e is DE0:;>TLBD" <NTE9N:>L$.$D" EFTE9N:>

:nalogHrite()

1H(

?!0H8 carrier

: -inal :ssignment

;sing the #arts and skills -rom the unit" and


anything else you might want to include" build
something ni-ty.

He ha)e a #ool o- e3tra #arts a)ailable:

7Segment >ED Dis#lay

9=B (tricolor) >ED (&olor mi3ing)

1ie8o Bu88er (Tiny" tinny" directly dri)able s#eaker)

Tem#erature Sensor

9eading Datasheets

Eey skill" de)elo#ed by #ractice

0ormats N2T well standardi8ed" e)en -or


similar #arts

>argely about -iltering -or what you want

Eind o- an art

0inal assignment #arts (and some other bits


and #ieces) as e3am#les

:cknowledgments

;nless otherwise marked" images used in this


#resentation are -rom the Hikimedia &ommons

You might also like