Multiplexer

416 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
416
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Multiplexer

  1. 1. Multiplexer R-tist
  2. 2. Pin configuration of multiplexer
  3. 3. program• int r0 = 0; //value of select pin at the 4051 • r1 = bitRead(count,1); // use this with (s0) arduino 0013 (and newer versions)• int r1 = 0; //value of select pin at the 4051 • r2 = bitRead(count,2); // use this with (s1) arduino 0013 (and newer versions)• int r2 = 0; //value of select pin at the 4051 • //r0 = count & 0x01; // old version of setting (s2) the bits• int count = 0; //which y pin we are selecting • //r1 = (count>>1) & 0x01; // old version of• void setup(){ setting the bits• pinMode(2, OUTPUT); // s0 • //r2 = (count>>2) & 0x01; // old version of• pinMode(3, OUTPUT); // s1 setting the bits• pinMode(4, OUTPUT); // s2 • digitalWrite(2, r0);• } • digitalWrite(3, r1);• void loop () { • digitalWrite(4, r2);• for (count=0; count<=7; count++) { • //Either read or write the multiplexed pin here• // select the bit • }• r0 = bitRead(count,0); // use this with • } arduino 0013 (and newer versions)

×