Advertisement
Guest User

Untitled

a guest
May 25th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <16f877.h>
  2. #use delay(clock=1M)
  3. int8 kesmesayac=0;
  4. #INT_TIMER1
  5. void t1kesme(){ //KS=(65536-3036)x4x4/1M=1sn
  6.    set_timer1(3036);
  7.    kesmesayac++;
  8.    if(kesmesayac%3==0){ //3sn'de bir bu if'e girecek
  9.       output_toggle(PIN_C0);
  10.    }
  11.    if(kesmesayac%5==0){ //5sn'de bir bu if'e girecek
  12.       output_toggle(PIN_C1);      
  13.    }
  14.    if (kesmesayac==15) kesmesayac=0;
  15. }
  16. void main(){
  17.    output_low(PIN_C0);
  18.    output_low(PIN_C1);
  19.    setup_timer_1(T1_INTERNAL | T1_DIV_BY_4);
  20.    set_timer1(3036);
  21.    enable_interrupts(INT_TIMER1);
  22.    enable_interrupts(GLOBAL);
  23.    while(true);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement