16 LED Chaser with Pic 16F877A Microcontroller
https://acrobat.adobe.com/link/review?uri=urn:aaid:scds:US:5b3da523-9228-3b61-9156-6f9d30dfa442
Open mikroC application.
click New project-standard project. click next.
provide a project name-LEDCHASER.
project folder- choose a folder in your computer.
select device- select a PIC microcontroller,Ex: p16F877A.
select device clock-8.000000(8 Mega hz)
click-next then click finish.
type the C code on MicroC editor, as per below👇
after complete code ,click on Build button on editor.
Open the proteus simulator and draw the circuit diagram as per above.👆
TRISB = 0x00; //all bits are initialized as output
PORTB= 0x00; //by default all pin are LOW
while(1)
{
PORTB =0b00000001 ;//0x01;
Delay_ms(100);
PORTB =0b00000010 ;//0x02;
Delay_ms(100);
PORTB = 0b00000100;//0x04;
Delay_ms(100);
PORTB = 0b00001000;//0x08;
Delay_ms(100);
PORTB = 0b00010000;//0x10;
Delay_ms(100);
PORTB = 0b00100000;//0x20;
Delay_ms(100);
PORTB = 0b01000000;//0x40;
Delay_ms(100);
PORTB = 0b10000000;//0x80;
Delay_ms(100);
PORTC =0b00000001 ;//0x01;
Delay_ms(100);
PORTC =0b00000010 ;//0x02;
Delay_ms(100);
PORTC = 0b00000100;//0x04;
Delay_ms(100);
PORTC = 0b00001000;//0x08;
Delay_ms(100);
PORTC = 0b00010000;//0x10;
Delay_ms(100);
PORTC = 0b00100000;//0x20;
Delay_ms(100);
PORTC = 0b01000000;//0x40;
Delay_ms(100);
PORTC = 0b10000000;//0x80;
Delay_ms(100);
}
}
Comments
Post a Comment