●Flashing LED Controlled by a Button
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(){
while(1){ // For an endless loop
if(!input(pin_a0)) //Checking the input of the first pin of port A
output_high(pin_b0); //If input is low, LED flashes
else output_low(pin_b0); //If input is high, LED doesn't flash
}
}
}