Docsity
Docsity

Prepare-se para as provas
Prepare-se para as provas

Estude fácil! Tem muito documento disponível na Docsity


Ganhe pontos para baixar
Ganhe pontos para baixar

Ganhe pontos ajudando outros esrudantes ou compre um plano Premium


Guias e Dicas
Guias e Dicas

Multiplexer/Demultiplexer com 4051, Notas de estudo de Engenharia Informática

Multiplexer/Demultiplexer com 4051

Tipologia: Notas de estudo

2012

Compartilhado em 23/11/2012

wellington-cassio-faria-8
wellington-cassio-faria-8 🇧🇷

4.5

(37)

129 documentos

1 / 2

Toggle sidebar

Esta página não é visível na pré-visualização

Não perca as partes importantes!

bg1
(edited) 2006 by tomek ness
for the arduino community <http://www.arduino.cc>
K3 - School of Arts and Communication <http://www.mah.se/k3>
fhp - University of Applied Scien <http://www.design.fh-potsdam.de>
analog multiplexer/demultiplexer------------4051
A multiplexer or demultiplexer enable you to expand the in- and outputs on your Arduino board.
The 4051 is an 8 channel analog multiplexer / demultiplexer, thus:
*If you use the 4051 as a Multiplexer: You can choose between 8 different inputs and
select just one you wane read at the time.
*If you use the 4051 as a Demultiplexer you can choose between 8 different
outputs and select just one you wane write at the time.
Futher more is the 4051 able to work with analog values; in the case of Arduino you are able to
use analog Inputs with a voltage between o-5V and rout them to a AnalogIn Pin on your Arduino.
To select the Pin we would like to read or write, we have to use the three Select Pins (S0, S1
and S2). Each of this pins have to be connected to one digitalOut Pin on the Arduino. Every pin
is representing a number (So = 1; S1 = 2; S2 = 4) and if we set one of this Select pins to HIGH
the curtained number the pin is representing will be transmitted to the 4051. For example:
*If S0 and S1 are HIGH and S2 is LOW pin y3 is selected (1+2+0 = 3).
*If S0 and S2 is HIGH and S1 LOW pin y5 is selected (1+0+4 = 5).
It is not possible to read or write more then one pin on the 4051 at the same time, because you
can just select one pin at the same time. But you can read and write this pins quit fast. There
is no delay needed between selecting and read or writing the pin.
Z ----- common input/output (connected to Arduino Input/Output)
E ----- enable input (active LOW) (connected to ground (gnd))
Vee --- negative supply voltage (connected to ground (gnd))
gnd --- ground (0 V)
S0-S2 - select inputs (connected to three arduino digitalOut Pins)
y0-y7 - independent inputs/outputs
Vcc --- positive supply voltage (5v)
8 Analog Inputs 1 Analog Output
Selected
through 3 digital
Outpins from the arduino
Analog
Inputs
Select Inputs
3 DigitalOutPins
from the arduino
Analog Output
To a AnlogInPin
at the arduino
4051
used as a
Multiplexer
Logic symbol
y3
y4
y5
y0
y1
y2
s0
s1
s2
y6
y7 z
4051
Pin configuration
z
y7
y5
y4
y6
E
Vee
3
4
5
1
2
6
7
14
13
12
16
15
11
10
8 9
y1
y0
y3
Vcc
y2
S0
S1
gnd S2
pf2

Pré-visualização parcial do texto

Baixe Multiplexer/Demultiplexer com 4051 e outras Notas de estudo em PDF para Engenharia Informática, somente na Docsity!

(edited) 2006 by tomek ness

for the arduino community http://www.arduino.cc

K3 - School of Arts and Communication http://www.mah.se/k3

fhp - University of Applied Scien http://www.design.fh-potsdam.de

analog multiplexer/demultiplexer------------

A multiplexer or demultiplexer enable you to expand the in- and outputs on your Arduino board.

The 4051 is an 8 channel analog multiplexer / demultiplexer, thus:

*If you use the 4051 as a Multiplexer: You can choose between 8 different inputs and

select just one you wane read at the time.

*If you use the 4051 as a Demultiplexer you can choose between 8 different

outputs and select just one you wane write at the time.

Futher more is the 4051 able to work with analog values; in the case of Arduino you are able to

use analog Inputs with a voltage between o-5V and rout them to a AnalogIn Pin on your Arduino.

To select the Pin we would like to read or write, we have to use the three Select Pins (S0, S

and S2). Each of this pins have to be connected to one digitalOut Pin on the Arduino. Every pin

is representing a number (So = 1; S1 = 2; S2 = 4) and if we set one of this Select pins to HIGH

the curtained number the pin is representing will be transmitted to the 4051. For example:

*If S0 and S1 are HIGH and S2 is LOW pin y3 is selected (1+2+0 = 3).

*If S0 and S2 is HIGH and S1 LOW pin y5 is selected (1+0+4 = 5).

It is not possible to read or write more then one pin on the 4051 at the same time, because you

can just select one pin at the same time. But you can read and write this pins quit fast. There

is no delay needed between selecting and read or writing the pin.

Z ----- common input/output (connected to Arduino Input/Output)

E ----- enable input (active LOW) (connected to ground (gnd))

Vee --- negative supply voltage (connected to ground (gnd))

gnd --- ground (0 V)

S0-S2 - select inputs (connected to three arduino digitalOut Pins)

y0-y7 - independent inputs/outputs

Vcc --- positive supply voltage (5v)

8 Analog Inputs 1 Analog Output

Selected

through 3 digital

Outpins from the arduino

Analog

Inputs

Select Inputs

3 DigitalOutPins

from the arduino

Analog Output

To a AnlogInPin

at the arduino

used as a

Multiplexer

Logic symbol

y

y

y

y

y

y

s

s

s

y

y7 z

Pin configuration

z

y

y

y

y

E

Vee

y

y

y

Vcc

y

S

S

gnd S

(edited) 2006 by tomek ness

for the arduino community http://www.arduino.cc

K3 - School of Arts and Communication http://www.mah.se/k3

fhp - University of Applied Scien http://www.design.fh-potsdam.de

The left sketch above is an example how to use 9 multiplexer to read 64 analog Inputs just with

one Analog-In-Pin on the arduino. The right sketch above is an example how to use two 4051 (one

as demultiplexer and one as multiplexer) in a 8x8 Matrix to check 64 buttons or other digital

Inputs just with one digital-In-Pin on the arduino(in this setup you can just have two buttons

turned on at the same time).

* codeexample for useing a 4051 * analog multiplexer / demultiplexer

* by david c. and tomek n.* for k3 / malmö högskola

int led = 13; //just a led

int r0 = 0; //value select pin at the 4051 (s0)

int r1 = 0; //value select pin at the 4051 (s1)

int r2 = 0; //value select pin at the 4051 (s2)

int row = 0; // storeing the bin code

int count = 0; // just a count

int bin [] = {000, 1, 10, 11, 100, 101, 110, 111};//bin = binär, some times it is so easy

void setup(){

pinMode(2, OUTPUT); // s

pinMode(3, OUTPUT); // s

pinMode(4, OUTPUT); // s

digitalWrite(led, HIGH);

beginSerial(9600);

void loop () {

for (count=0; count<=7; count++) {

row = bin[count];

r0 = row & 0x01;

r1 = (row>>1) & 0x01;

r2 = (row>>2) & 0x01;

digitalWrite(2, r0);

digitalWrite(3, r1);

digitalWrite(4, r2);

//Serial.println(bin[count]);

delay (1000);

s s s y y y

y y y

y y

A

A

A

A

A

A

A

A8 z A

s s s y y y

y y y

y y

B

B

B

B

B

B

B

B8 z B

s s s y y y

y y y

y y

D

E

F

A

B

C

G

H z AnalogInPin

DigitalOutPin

s s s y y y

y y y

y y

H

H

H

H

H

H

H

H8 z H

DigitalOutPin

(c) björn wahlström and thomas ness for Re-Memorize - k3 / 2005

s s s y y y

y y y

y y

D

E

F

A

B

C

G

H z

(c) björn wahlström and thomas ness for Re-Memorize - k3 / 2005

Digital-Out-Pin

Vcc [5v]

Digital-In-Pin

GND

s0s1s y0y1y2y3y4y5y6y

z