LED sequencer use CD4017 with PIC Micrcontroller
In this tutorial we will learn how to make make LED sequencer use CD4017 IC. Here I am use PIC16F877A Microcontroller for pulse generator. You can watch the video or read the written tutorial below.
CD4017 IC
CD4017 decade counter with 10 bit decoded output. CD4017 is 5 stage Johnsor counters having 10 bit decoded outputs respectively. Inputs include a CLOCK, and a RESET, a CLOCK INHIBIT signal. Schmit trigger action in the clock input circuit provide pulse shaping that allows unlimited clock input pulse rise time and fall time.
Circuit Diagram:
Mikro C Code:
# define SW PORTB.B0
void main() {
TRISB7_bit = 0; // RB7 is output port
PORTB.F7 = 0; // clear RB7
TRISB6_bit = 0; // RB6 is output port
PORTB.F6 = 0; // clear RB6
TRISB0_bit = 1; // RB0 is output port
PORTB.F0 = 0; // clear RB0
while(1){
if(SW==1){
while(SW==1);
PORTB.F6 = ~PORTB.F6; // RB6 is toggle
}
PORTB.F7 = 1;
Delay_ms(50);
PORTB.F7 = 0;
Delay_ms(50);
}
}
Click the download button for program file:
CD4017 IC
CD4017 |
pin diagram of CD4017 |
Circuit Diagram:
Mikro C Code:
# define SW PORTB.B0
void main() {
TRISB7_bit = 0; // RB7 is output port
PORTB.F7 = 0; // clear RB7
TRISB6_bit = 0; // RB6 is output port
PORTB.F6 = 0; // clear RB6
TRISB0_bit = 1; // RB0 is output port
PORTB.F0 = 0; // clear RB0
while(1){
if(SW==1){
while(SW==1);
PORTB.F6 = ~PORTB.F6; // RB6 is toggle
}
PORTB.F7 = 1;
Delay_ms(50);
PORTB.F7 = 0;
Delay_ms(50);
}
}
Click the download button for program file:
download |
No comments