You are on page 1of 6

POST-LAB ESPUA (4109) ASSIGNMENT Date:

Experiment – 7
Aim of the Experiment:

Implementation of logical as well as circular bit shifter and binary bit flipper using Serial to
Parallel Shift Register (74HC595).

Objective:

1) Introduction to Number System. Familiarization with Number system conversion.


2) Familiarization with Serial to Parallel Shift Convertor / Register (74HC595) and interfacing
74HC595 with arduino.
3) Implementation of a Binary Counter with Serial to Parallel Shift Convertor / Register
(74HC595)
4) Implementation of a logical left and right bit shifter with Serial to Parallel Shift Convertor /
Register (74HC595)
5) Implementation of a Circular left and right bit shifter with Serial to Parallel Shift Convertor /
Register (74HC595)
6) Implementation of a Binary bit flipper with Serial to Parallel Shift Convertor / Register
(74HC595)

Components/Equipment Required:

Sl No. Name of the Specification Quantity


Component/Equipeme
nt
1 Arduino UNO R3 16MHz 1
2 Arduino UNO cable USB Type A to B 1
3 Resistors (carbon type) ¼ watt (330Ω) 8
4 8-bit Shift Register 74HC595 1
5 LED Red, Green, 2 each
Blue, White
6 Breadboard 840 Tie points 1
7 Jumper Wire ----------------------- As per requirement

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Implementation of logical as well as circular bit shifter and binary bit flipper using Serial to Parallel Shift
Register (74HC595).
POST-LAB ESPUA (4109) ASSIGNMENT
Experiment – 7

Code:
Objective 1
int latchpin=5;
int clockpin=6;
int datapin=4;
int dt=1000;

byte l1=0b10101010;
byte l2=0b01010101;

void setup() {
Serial.begin(9600);
pinMode(latchpin,OUTPUT);
pinMode(datapin,OUTPUT);
pinMode(clockpin,OUTPUT);
}

void loop() {
digitalWrite(latchpin,LOW);
shiftOut(datapin,clockpin,LSBFIRST,l1);
digitalWrite(latchpin,HIGH);
delay(dt);
digitalWrite(latchpin,LOW);
shiftOut(datapin,clockpin,LSBFIRST,l2);
digitalWrite(latchpin,HIGH);
delay(dt);
}
Objective 2
int latchpin=5;
int clockpin=6;
int datapin=4;
int dt=1000;

byte l1=0b10101010;
byte l2=0b01010101;

void setup() {
Serial.begin(9600);
pinMode(latchpin,OUTPUT);
pinMode(datapin,OUTPUT);
pinMode(clockpin,OUTPUT);
}

void loop() {
digitalWrite(latchpin,LOW);
shiftOut(datapin,clockpin,LSBFIRST,l1);
digitalWrite(latchpin,HIGH);
delay(dt);
digitalWrite(latchpin,LOW);
shiftOut(datapin,clockpin,LSBFIRST,l2);
digitalWrite(latchpin,HIGH);
delay(dt);
}

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Implementation of logical as well as circular bit shifter and binary bit flipper using Serial to Parallel Shift
Register (74HC595).
POST-LAB ESPUA (4109) ASSIGNMENT
Experiment – 7
Objective 3
int latchpin=5;
int clockpin=6;
int datapin=4;
int dt=1000;

byte myByte=0b00000001;

void setup() {
Serial.begin(9600);
pinMode(latchpin,OUTPUT);
pinMode(datapin,OUTPUT);
pinMode(clockpin,OUTPUT);
}
void loop() {
digitalWrite(latchpin,LOW);
shiftOut(datapin,clockpin,LSBFIRST,myByte);
digitalWrite(latchpin,HIGH);
delay(dt);
myByte = myByte*2;
}
Objective 4
int latchpin=5;
int clockpin=6;
int datapin=4;
int dt=1000;

byte myByte=0b10000000;

void setup() {
Serial.begin(9600);
pinMode(latchpin,OUTPUT);
pinMode(datapin,OUTPUT);
pinMode(clockpin,OUTPUT);
}
void loop() {
digitalWrite(latchpin,LOW);
shiftOut(datapin,clockpin,LSBFIRST,myByte);
digitalWrite(latchpin,HIGH);
delay(dt);
myByte = myByte/2;
}
Objective 5
int tiltPin=2;
int tiltVal;
int redPin=7;
int greenPin=6;
void setup() {
// put your setup code here, to run once:
pinMode(tiltPin,INPUT);
pinMode(redPin,OUTPUT);
pinMode(greenPin,OUTPUT);
digitalWrite(tiltPin,HIGH);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
tiltVal=digitalRead(tiltPin);

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Implementation of logical as well as circular bit shifter and binary bit flipper using Serial to Parallel Shift
Register (74HC595).
POST-LAB ESPUA (4109) ASSIGNMENT
Experiment – 7
Serial.println(tiltVal);
if (tiltVal==0){
digitalWrite(greenPin,HIGH);
digitalWrite(redPin,LOW);
}
if (tiltVal==1){
digitalWrite(greenPin,LOW);
digitalWrite(redPin,HIGH);
}
}
Objective 6
int latchpin=5;
int clockpin=6;
int datapin=4;
int dt=1000;
byte myByte=0b10000000;
void setup() {
Serial.begin(9600);
pinMode(latchpin,OUTPUT);
pinMode(datapin,OUTPUT);
pinMode(clockpin,OUTPUT);
}
void loop() {
digitalWrite(latchpin,LOW);
shiftOut(datapin,clockpin,LSBFIRST,myByte);
digitalWrite(latchpin,HIGH);
delay(dt);
myByte = myByte*2 +myByte/128;
}
Observation:

Objective 1

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Implementation of logical as well as circular bit shifter and binary bit flipper using Serial to Parallel Shift
Register (74HC595).
POST-LAB ESPUA (4109) ASSIGNMENT
Experiment – 7

Objective 2

Objective 3

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Implementation of logical as well as circular bit shifter and binary bit flipper using Serial to Parallel Shift
Register (74HC595).
POST-LAB ESPUA (4109) ASSIGNMENT
Experiment – 7
Objective 4

Objective 5

Objective 6

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Implementation of logical as well as circular bit shifter and binary bit flipper using Serial to Parallel Shift
Register (74HC595).

You might also like