Advertisement
aperles

10 kHz

May 23rd, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. sfr ...
  2. sbit ...
  3.  
  4. sbit salida = P1^0;
  5.  
  6. void main (void) {
  7.  
  8.    
  9.    EA = 0;  // desconectar sistema de interrupciones
  10.  
  11.    // programar dispositivo fuente
  12.    TR0 = 0;
  13.    TF0 = 0;
  14.    TMOD & = 0xF1;
  15.    TMOD | = 0x01;
  16.    TH0 = 256-50;
  17.    TL0 = 256-50;
  18.    //TRO=1;
  19.  
  20.    // activar interrupcion fuente
  21.    ET0 = 1;
  22.    // activar sistema d'interrupcions
  23.    EA = 1;
  24.  
  25.    TRO = 1;
  26.  
  27.    while (1) {
  28.     /* altres coses */
  29.    }
  30. } // s'ha acabat main()
  31.  
  32. // servei d'interrupcio ----------------------------
  33. void pepito(void) interrupt 1 {
  34.     if (salida == 0) {
  35.         salida = 1;
  36.     } else {
  37.         salida = 0;
  38.     }
  39.    }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement