●Counting from 9 to 0 on 7-Segment Display
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) //To define the delay time correctly
void main(){
char series[]={63,6,91,79,102,109,125,7,127,111}; //Defining the decimal values of total logic values on 7-segment display
char x=9; //To start the loop from 9nd value
while(1){
do{
output_b(series[x]); //To show the desired value on 7-segment display
delay_ms(250); //Delay for observation
x--;
}while((x+1)); //To end the loop
x=9;
}
}