Demo entry 6314794

Intento

   

Submitted by anonymous on Oct 28, 2016 at 08:30
Language: C. Code size: 1.2 kB.

#include <16F887.h>
#use delay(clock = 20M)
#fuses XT         //Oscilador a cristal standar.
#fuses NOWDT      //sin WatchDog Timer.
#fuses NOPROTECT  //sin proteccion de memoria de programa.
#fuses NOPUT      //sin PowerUp Timer.
#fuses NOBROWNOUT //sin brownout.
#fuses NOLVP      //sin programació en baja tensión.
#use standard_io(b)
#use standard_io(c)
#use standard_io(d)
#use standard_io(e)

void main() {
   short DT_C;
   short CLK_C;
   short DT_M;
   short CLK_M;
   while (true) {
      DT_C = input(PIN_E1);
      CLK_C = input(PIN_E0);
      output_bit(PIN_C7, DT_C);
      output_bit(PIN_C4, CLK_C);
      if (DT_C > CLK_C) {
         do {
            DT_M = input(PIN_B1);
            CLK_M = input(PIN_B2);
            output_c(0x08);
            delay_ms(5);
            output_c(0x00);
            delay_ms(5);
         } while (DT_M >= CLK_M);
      } else if (DT_C < CLK_C) {
         do {
            DT_M = input(PIN_B1);
            CLK_M = input(PIN_B2);
            output_c(0x02);
            delay_ms(5);
            output_c(0x00);
            delay_ms(5);
         } while (DT_M <= CLK_M);
      }
   }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).