Blogroll

Powered by Blogger.

Tuesday 5 August 2014

Johnson Counter Demonstration using 74HC4017 / 74HCT4017 and Arduino Mega

by realfinetime  |  in Johnson Counter at  06:19

          We have already seen Animated Presentation of Working of 74HC4017 / 74HCT4017, Johnson Counter with Circuit Diagram. In this blog we will demonstrate the same johnson counter using Arduino Mega.


          Circuit is done as shown in the diagram given above. Three inputs ( CP0, CP1 and MR ) to 74HC4017 / 74HCT4017 is given from Arduino Mega.

Pin13 of Arduino is connected to CP1bar ( Pin 13 ) of 74HC4017 / 74HCT4017.
Pin12 of Arduino is connected to CP0 ( Pin 14 ) of 74HC4017 / 74HCT4017.
Pin11 of Arduino is connected to MR ( Pin 15 ) of 74HC4017 / 74HCT4017.

         74HC4017 / 74HCT4017 is a commonly used 5-stage Johnson Decade counter IC. It has 10 decoded outputs ( Q0-Q9 ), an output from most significant flip-flop ( Qbar5-9 ), two clock inputs ( CP0 and CP1bar ) and a master reset ( MR ) input. 5V for the operation of 74HC4017 / 74HCT4017 is given from a 5V voltage regulator. Pinout diagram of  74HC4017 / 74HCT4017 is given below.


Features of 74HC4017 / 74HCT4017

1. Wide supply voltage range from 2V - 6V
2. Input levels of 74HC4017 / 74HCT4017
    For 74HC4017    -  CMOS level.
    For 74HCT4017  -  TTL level.
3. A HIGH on MR will reset the counter ( Q0 = HIGH, Qbar5-9 = HIGH, Q1-Q9 = LOW ).

74HC4017 / 74HCT4017 counter can be operated in two modes.

1. Counts during the positive transition of clock pulse.
2. Counts during the negative transition of clock pulse.

Circuit for the counter that counts in the positive transition of clock pulse

1. Connect CP1bar to ground.
2. Connect MR to ground.
3. Connect CP0 to 5V and Ground through a pull up resistor and push button switch correspondingly.   Push button switch will be in off state by default. Then CP0 will get 5V through 1K pull up resistor and hence will be at logical HIGH. When switch is pressed, it will turn on and CP0 get grounded through push button switch. This is a transition from HIGH to LOW voltage. Counter will increment during LOW to HIGH transition only. When the press is released, switch will turn off and a transition from LOW to HIGH voltage occur. Then counter will increment count.


Arduino program to count during the positive transition of clock pulse

int CP1bar = 13; // CP1bar ( Pin 13 ) of 74HC4017 / 74HCT4017 is connected to 13th Pin of Arduino
int CP0 = 12;      // CP0 ( Pin 14 ) of 74HC4017 / 74HCT4017 is connected to 12th Pin of Arduino
int MR = 11;       // MR ( Pin 15 ) of 74HC4017 / 74HCT4017 is connected to 11th Pin of Arduino

// the setup routine runs once when you press reset:

void setup() {                
  // initialize the digital pins as an output.
  pinMode(CP1bar, OUTPUT);   
  pinMode(CP0, OUTPUT);
  pinMode(MR, OUTPUT);  
}

// the loop routine runs over and over again forever:

void loop() {
  digitalWrite(CP1bar, LOW);   // Send LOW voltage to CP1bar
  digitalWrite(MR, LOW);         // Send LOW voltage to MR
  digitalWrite(CP0, HIGH);       // Send HIGH voltage to CP0

  delay(1000);

  digitalWrite(CP1bar, LOW);   // Send LOW voltage to CP1bar
  digitalWrite(MR, LOW);         // Send LOW voltage to MR
  digitalWrite(CP0, LOW);        // Send LOW voltage to CP0

  delay(1000);
}


Circuit for the counter that counts in the negative transition of clock pulse

1. Connect CP0 to 5V.
2. Connect MR to ground.
3. Connect CP1bar to 5V and Ground through a pull up resistor and push button switch correspondingly. Push button switch will be in off state by default. Then CP1bar will get 5V through 1K pull up resistor and hence will be at logical HIGH. When switch is pressed, it will turn on and CP1bar get grounded through push button switch. This is a transition from HIGH to LOW voltage. Then counter will increment count. When the press is released, switch will turn off and a transition from LOW to HIGH voltage occur. Counter will not change because, counter will increment during HIGH to LOW transition only.


Arduino program to count during the negative transition of clock pulse

int CP1bar = 13; // CP1bar ( Pin 13 ) of 74HC4017 / 74HCT4017 is connected to 13th Pin of Arduino
int CP0 = 12;      // CP0 ( Pin 14 ) of 74HC4017 / 74HCT4017 is connected to 12th Pin of Arduino
int MR = 11;       // MR ( Pin 15 ) of 74HC4017 / 74HCT4017 is connected to 11th Pin of Arduino

// the setup routine runs once when you press reset:

void setup() {                
  // initialize the digital pins as an output.
  pinMode(CP1bar, OUTPUT);   
  pinMode(CP0, OUTPUT);
  pinMode(MR, OUTPUT);  
}

// the loop routine runs over and over again forever:

void loop() {
  digitalWrite(CP1bar, HIGH);   // Send HIGH voltage to CP1bar
  digitalWrite(MR, LOW);         // Send LOW voltage to MR
  digitalWrite(CP0, HIGH);       // Send HIGH voltage to CP0

  delay(1000);

  digitalWrite(CP1bar, LOW);   // Send LOW voltage to CP1bar
  digitalWrite(MR, LOW);         // Send LOW voltage to MR
  digitalWrite(CP0, HIGH);        // Send HIGH voltage to CP0

  delay(1000);
}

        Output of the counter can be obtained from the LEDs connected to Q0 - Q9 and Qbar5-9. Qbar5-9 can be used to drive the CP0 input of next counter. Qbar5-9 will be HIGH, if  any of Q0, Q1, Q2, Q3 or Q4 is HIGH and Qbar5-9 will be LOW, if  any of Q5, Q6, Q7, Q8 or Q9 is HIGH.

0 comments:

IMPORTANT NOTICE

All the circuits, published in this blog is only after testing and getting proper results in my private lab. When you try these circuits, you should check the supply voltage, polarity of components, presence of childrens nearby and shorts in the circuits. This website will not be responsible for any harm happened to you or your components caused by your carelessness.

For More Electronic Tips



Blog Archive

Proudly Powered by Blogger.