Timer 0 mode timer For CSS Compiler

 

// Generator frequency 100 Hz   with Timer0 For Pic16f877     //  
//#include "D:\MICRO_PICC_Group\timer\timer_0\timer_0_100hz.h"
#include <16F877.h>
#device adc=8
#FUSES NOWDT,XT                    //No Watch Dog Timer
#use delay(clock=4000000)

int1 time;
#int_RTCC
void  RTCC_isr(void) 
{
  output_toggle(pin_b0);
/*  
 time =!time;
   if(time==1){
      output_high(pin_b0);
   }
   if(time==0){
      output_low(pin_b0);
   }*/
   set_timer0(236);
}

void main()
{
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   enable_interrupts(INT_RTCC);
   enable_interrupts(GLOBAL);
   set_timer0(236);   
   set_tris_b(0x00);
   time =0;
   while (TRUE){
      output_high(pin_b5);
      delay_ms(5);
      output_low(pin_b5);
      delay_ms(5);
   }
}

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.