MPI4
MPI4
MPI4
Lab#03
THEORITICAL BACKGROUND:
7 SEGMENT CIRCUIT:
A 7-segment display is a common electronic component used to display numerical digits and some letters or
characters. Each digit is composed of seven individually controllable segments, and by turning on or off these
segments, you can display numbers and some characters. To create a circuit to control a 7-segment display,
you will typically need a microcontroller or other digital logic circuitry.
Components 7-segment display: This is the main component that has seven segments arranged in the shape
of the digit "8". Each segment can be turned on or off independently to display different numbers and
characters.
Resistor: A current-limiting resistor is typically used to limit the current flowing through each segment to
prevent them from burning out. The value of this resistor depends on the specific display and power supply
voltage.
Microcontroller or digital logic circuit: This is the brain of the circuit that controls which segments are
turned on to display the desired number or character.
Power supply: To provide the necessary voltage for the 7-segment display and other components.
CA 7447:
The 7447 IC is used to convert a 4-bit Binary-Coded Decimal (BCD) input into the appropriate signals to
drive a 7-segment display to show decimal numbers. Here's a basic explanation of how to use the 7447 IC in
a 7-segment display circuit:
Components:
• 7447 IC: This is the BCD to 7-segment decoder/driver IC.
• 7-segment display: The display where you want to show the numbers.
• BCD Inputs (A, B, C, D): These inputs are used to provide the BCD code for the number you want
to display. Connect them to a source that provides the BCD input (e.g., a microcontroller or manual
switches).
• 7-segment output: The seven output pins of the 7447 IC (a, b, c, d, e, f, g) are connected to the
corresponding segments of the 7-segment display.
CC 7448:
The IC 7448 is a BCD to 7-segment latch/decoder/driver, similar to the 7447 but with a few differences. You
can use the 7448 IC to drive a 7-segment display in a circuit. Here's how you can use the 7448 IC in a 7-
segment display circuit:
Components:
• 7448 IC: This is the BCD to 7-segment latch/decoder/driver IC.
• 7-segment display: The display that you want to use to show numerical values.
• BCD Inputs (A, B, C, D): These inputs are used to provide the BCD code for the number you want to display.
Connect them to a source that provides the BCD input (e.g., a microcontroller or manual switches).
An up-down counter is a type of digital counter that can count in both the upward (increasing) and
downward (decreasing) directions. It's a versatile counter used in various digital applications where the
counting sequence needs to be bidirectional. Here's a basic explanation:
Up Counter: In an up counter, the count increases sequentially with each clock pulse. For example, if you
start from 0 and increment by 1 for each clock pulse, the sequence would be 0, 1, 2, 3, and so on.
Down Counter: In a down counter, the count decreases sequentially with each clock pulse. Starting from a
higher value and decrementing by 1 for each clock pulse, the sequence might be 10, 9, 8, 7, and so forth.
Up-Down Counter: An up-down counter, as the name suggests, is capable of counting both upwards and
downwards based on the control signal. It can increment (up) or decrement (down) the count based on the
state of a control input.
OBJECTIVE:
Construct 7 segment circuit and generate up and down circuit.
COMPONENT REQUIRED:
• Arduino.
• Proteus.
• Ic 7447.
• Ic7448.
• 7 segment led.
CIRCUIT DIAGRAM:
ARD1
AREF U1
13 7 13
PB5/SCK A QA
12 1 12
PB4/MISO B QB
RESET 11 2 11
~PB3/MOSI/OC2A C QC
10 6 10
~ PB2/SS/OC1B D QD
9 4 9
~ PB1/OC1A BI/RBO QE
8 5 15
PB0/ICP1/CLKO RBI QF
3 14
ATMEGA328P-PU
1121
DIGITAL (~PWM)
LT QG
7
ANALOG IN
PD7/AIN1 U2
6 7447
A0 ~ PD6/AIN0
PC0/ADC0 5 7 13
A1 ~ PD5/T1 A QA
PC1/ADC1 4 1 12
A2 PD4/T0/XCK B QB
PC2/ADC2 3 2 11
A3 ~ PD3/INT1 C QC
PC3/ADC3 2 6 10
A4 PD2/INT0 D QD
PC4/ADC4/SDA 1 4 9
A5 TX PD1/TXD BI/RBO QE
PC5/ADC5/SCL 0 5 15
RX PD0/RXD RBI QF
3 14
LT QG
ARDUINO UNO R3 7447
SOURCE CODE:
int a,count=0,convert=0,bit_value;
int pins[]={13,12,11,10,5,4,3,2};
void setup()
{
for(a=0;a<=7;a++)
{
pinMode(pins[a],OUTPUT);
}
}
void loop()
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(300);
count++;
if(count==100)
{
count=0;
convert=0;
}
}
int bintobcd(int recv)
{
int q,r;
q=recv/10;
r=recv%10;
q=q<<4;
q=q|r;
return q;
}
SOURCE CODE:
int a,count=99,convert=0,bit_value;
int pins[]={13,12,11,10,5,4,3,2};
void setup()
{
for(a=0;a<=7;a++)
{
pinMode(pins[a],OUTPUT);
}
}
void loop()
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(300);
count--;
if(count<0)
{
count=99;
convert=99;
}
}
int bintobcd(int recv)
{
int q,r;
q=recv/10;
r=recv%10;
q=q<<4;
q=q|r;
return q;
}
SOURCE CODE:
int a,count=0,convert=0,bit_value;
int pins[]={13,12,11,10,5,4,3,2};
void setup()
{
for(a=0;a<=7;a++)
{
pinMode(pins[a],OUTPUT);
}
}
void loop()
{
for(count=0;count<=99;count++)
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(200);
}
for(count=99;count>=0;count--)
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(200);
}
}
int bintobcd(int recv)
{
int q,r;
q=recv/10;
r=recv%10;
q=q<<4;
q=q|r;
return q;
}
ARD1
AREF U1
13 7 13
PB5/SCK A QA
12 1 12
PB4/MISO B QB
RESET 11 2 11
~PB3/MOSI/OC2A C QC
10 6 10
~ PB2/SS/OC1B D QD
9 4 9
~ PB1/OC1A BI/RBO QE
8 5 15
PB0/ICP1/CLKO RBI QF
3 14
ATMEGA328P-PU
1121
DIGITAL (~PWM)
LT QG
7
ANALOG IN
PD7/AIN1 U2
6 7447
A0 ~ PD6/AIN0
PC0/ADC0 5 7 13
A1 ~ PD5/T1 A QA
PC1/ADC1 4 1 12
A2 PD4/T0/XCK B QB
PC2/ADC2 3 2 11
A3 ~ PD3/INT1 C QC
PC3/ADC3 2 6 10
A4 PD2/INT0 D QD
PC4/ADC4/SDA 1 4 9
A5 TX PD1/TXD BI/RBO QE
PC5/ADC5/SCL 0 5 15
RX PD0/RXD RBI QF
3 14
LT QG
ARDUINO UNO R3 7447
CONCLUSION:
Up-down counters are commonly used in various applications, including digital electronics, microcontrollers,
industrial automation, timers, and more. They allow for greater flexibility in counting operations where you
need to keep track of both increasing and decreasing values. The specific behavior of an up-down counter is
controlled by external signals, and it can be used to create a wide range of counting and control sequences in
digital circuits
7 SEGMENT CIRCUIT:
A 7-segment display is a common electronic component used to display numerical digits and some letters or
characters. Each digit is composed of seven individually controllable segments, and by turning on or off these
segments, you can display numbers and some characters. To create a circuit to control a 7-segment display,
you will typically need a microcontroller or other digital logic circuitry.
Components 7-segment display: This is the main component that has seven segments arranged in the shape
of the digit "8". Each segment can be turned on or off independently to display different numbers and
characters.
Resistor: A current-limiting resistor is typically used to limit the current flowing through each segment to
prevent them from burning out. The value of this resistor depends on the specific display and power supply
voltage.
Microcontroller or digital logic circuit: This is the brain of the circuit that controls which segments are
turned on to display the desired number or character.
Power supply: To provide the necessary voltage for the 7-segment display and other components.
CA 7447:
The 7447 IC is used to convert a 4-bit Binary-Coded Decimal (BCD) input into the appropriate signals to
drive a 7-segment display to show decimal numbers. Here's a basic explanation of how to use the 7447 IC in
a 7-segment display circuit:
Components:
• 7447 IC: This is the BCD to 7-segment decoder/driver IC.
• 7-segment display: The display where you want to show the numbers.
• BCD Inputs (A, B, C, D): These inputs are used to provide the BCD code for the number you want
to display. Connect them to a source that provides the BCD input (e.g., a microcontroller or manual
switches).
• 7-segment output: The seven output pins of the 7447 IC (a, b, c, d, e, f, g) are connected to the
corresponding segments of the 7-segment display.
CC 7448:
The IC 7448 is a BCD to 7-segment latch/decoder/driver, similar to the 7447 but with a few differences. You
can use the 7448 IC to drive a 7-segment display in a circuit. Here's how you can use the 7448 IC in a 7-
segment display circuit:
Components:
• 7448 IC: This is the BCD to 7-segment latch/decoder/driver IC.
• 7-segment display: The display that you want to use to show numerical values.
• BCD Inputs (A, B, C, D): These inputs are used to provide the BCD code for the number you want to display.
Connect them to a source that provides the BCD input (e.g., a microcontroller or manual switches).
An up-down counter is a type of digital counter that can count in both the upward (increasing) and
downward (decreasing) directions. It's a versatile counter used in various digital applications where the
counting sequence needs to be bidirectional. Here's a basic explanation:
Even Counter: In an even counter, the count increments sequentially with each clock pulse, and it generates
a signal or output when the count reaches an even number. For example, when the count is 0, 2, 4, 6, and so
on, the even counter would produce an output signal.
Odd Counter: In an odd counter, the count also increments with each clock pulse, but it generates an output
signal when the count reaches an odd number. So, when the count is 1, 3, 5, 7, and so on, the odd counter
produces an output.
OBJECTIVE:
Construct 7 segment circuit and generate even,odd up and down circuit.
COMPONENT REQUIRED:
• Arduino.
• Proteus.
• Ic 7447.
• Ic7448.
• 7 segment led.
CIRCUIT DIAGRAM:
ARD1
AREF U1
13 7 13
PB5/SCK A QA
12 1 12
PB4/MISO B QB
RESET 11 2 11
~PB3/MOSI/OC2A C QC
10 6 10
~ PB2/SS/OC1B D QD
9 4 9
~ PB1/OC1A BI/RBO QE
8 5 15
PB0/ICP1/CLKO RBI QF
3 14
ATMEGA328P-PU
1121
DIGITAL (~PWM)
LT QG
7
ANALOG IN
PD7/AIN1 U2
6 7447
A0 ~ PD6/AIN0
PC0/ADC0 5 7 13
A1 ~ PD5/T1 A QA
PC1/ADC1 4 1 12
A2 PD4/T0/XCK B QB
PC2/ADC2 3 2 11
A3 ~ PD3/INT1 C QC
PC3/ADC3 2 6 10
A4 PD2/INT0 D QD
PC4/ADC4/SDA 1 4 9
A5 TX PD1/TXD BI/RBO QE
PC5/ADC5/SCL 0 5 15
RX PD0/RXD RBI QF
3 14
LT QG
ARDUINO UNO R3 7447
SOURCE CODE:
int a,count=0,convert=0,bit_value;
int pins[]={13,12,11,10,5,4,3,2};
void setup()
{
for(a=0;a<=7;a++)
{
pinMode(pins[a],OUTPUT);
}
}
void loop()
{
for(count=0;count<=99;count+=2)
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(200);
}
for(count=98;count>=0;count-=2)
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(200);
}
}
int bintobcd(int recv)
{
int q,r;
q=recv/10;
r=recv%10;
q=q<<4;
q=q|r;
return q;
}
Task 02:
Odd counter.
SOURCE CODE:
int a,count=0,convert=0,bit_value;
int pins[]={13,12,11,10,5,4,3,2};
void setup()
{
for(a=0;a<=7;a++)
{
pinMode(pins[a],OUTPUT);
}
}
void loop()
{
for(count=1;count<=99;count+=2)
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(200);
}
for(count=99;count>=0;count-=2)
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(200);
}
}
int bintobcd(int recv)
{
int q,r;
q=recv/10;
r=recv%10;
q=q<<4;
q=q|r;
return q;
}
Task 03:
Even and Odd counter.
SOURCE CODE:
int a,count=0,convert=0,bit_value;
int pins[]={13,12,11,10,5,4,3,2};
void setup()
{
for(a=0;a<=7;a++)
{
pinMode(pins[a],OUTPUT);
}
}
void loop()
{
for(count=0;count<=99;count+=2)
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(200);
}
for(count=99;count>=0;count-=2)
{
convert=bintobcd(count);
for(a=0;a<=7;a++)
{
bit_value=bitRead(convert,a);
digitalWrite(pins[a],bit_value);
}
delay(200);
}
}
int bintobcd(int recv)
{
int q,r;
q=recv/10;
r=recv%10;
q=q<<4;
q=q|r;
return q;
}
RESULT:
ARD1
AREF U1
13 7 13
PB5/SCK A QA
12 1 12
PB4/MISO B QB
RESET 11 2 11
~PB3/MOSI/OC2A C QC
10 6 10
~ PB2/SS/OC1B D QD
9 4 9
~ PB1/OC1A BI/RBO QE
8 5 15
PB0/ICP1/CLKO RBI QF
3 14
ATMEGA328P-PU
1121
DIGITAL (~PWM)
LT QG
7
ANALOG IN
PD7/AIN1 U2
6 7447
A0 ~ PD6/AIN0
PC0/ADC0 5 7 13
A1 ~ PD5/T1 A QA
PC1/ADC1 4 1 12
A2 PD4/T0/XCK B QB
PC2/ADC2 3 2 11
A3 ~ PD3/INT1 C QC
PC3/ADC3 2 6 10
A4 PD2/INT0 D QD
PC4/ADC4/SDA 1 4 9
A5 TX PD1/TXD BI/RBO QE
PC5/ADC5/SCL 0 5 15
RX PD0/RXD RBI QF
3 14
LT QG
ARDUINO UNO R3 7447
CONCLUSION:
Even and odd counters are used in digital circuits and systems where it is necessary to perform different
operations or trigger events based on whether the count is even or odd. These counters can be implemented
using various digital logic elements and can be integrated into more complex digital systems to control specific
functions or sequences. They are used in applications like timing and sequencing in digital electronics and
microcontroller-based systems