●Flashing LEDs from Right to Left
Here is the program written by using CCS C.
#include <16f628.h>
#fuses NOPROTECT, NOWDT, NOLVP, NOMCLR INTRC_IO //Adding internal oscillator with INTRC_IO and MCLR makes possible to reset but with NOMCLR there is no need to connect anything that pin
#use delay(clock=4M)
void main(){
char a=128; //To define the first flashing LED
while(1){ // For an endless loop
output_b(a); // Defines which output's pin is going high and flashes the LED
delay_ms(250); //Delay the process to see the flash of a LED
if(a) a=a>>1; //To get high level at the output of the next pin
else a=128; //To start again from the first LED
}
}