Multiplexer/Demultiplexer com 4051, Notas de estudo de Engenharia Informática
wellington-cassio-faria-8
wellington-cassio-faria-8

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

2 páginas
50Números de download
1000+Número de visitas
Descrição
Multiplexer/Demultiplexer com 4051
50 pontos
Pontos de download necessários para baixar
este documento
Baixar o documento
Pré-visualização2 páginas / 2

(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

(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); // s0 pinMode(3, OUTPUT); // s1 pinMode(4, OUTPUT); // s2 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); } }

4051

s0

s1

s2

y3

y4

y5

y0

y1

y2

y6

y7

A4

A5

A6

A1

A2

A3

A7

A8 z A

4051

s0

s1

s2

y3

y4

y5

y0

y1

y2

y6

y7

B4

B5

B6

B1

B2

B3

B7

B8 z B

4051

s0

s1

s2

y3

y4

y5

y0

y1

y2

y6

y7

D

E

F

A

B

C

G

H z AnalogInPin

4051

DigitalOutPin

s0

s1

s2

y3

y4

y5

y0

y1

y2

y6

y7

H4

H5

H6

H1

H2

H3

H7

H8 z H

2 3

4 DigitalOutPin

5 6

7

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

4051

s0

s1

s2

y3

y4

y5

y0

y1

y2

y6

y7

D

E

F

A

B

C

G

H z

5

6 7

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

4 0

5 1

Digital-Out-Pin

Vcc [5v]

Digital-In-Pin

GND

s0 s1 s2

y 3

y 4

y 5

y 0

y 1

y 2

y 6

y 7

z

2 3

4

1 2 3 4 5 6 7 8

Até o momento nenhum comentário