Electgpl

PIC - Prueba SR 74164

Dec 16th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.09 KB | None | 0 0
  1. #include <12F675.h>
  2. #FUSES NOWDT
  3. #FUSES INTRC_IO
  4. #FUSES NOCPD
  5. #FUSES NOPROTECT
  6. #FUSES NOMCLR
  7. #FUSES NOPUT
  8. #FUSES NOBROWNOUT
  9. #use delay(int=4000000)
  10. #define DATO PIN_A1
  11. #define CLK  PIN_A0
  12. void main(){
  13.    int i,j;      
  14.    byte valor;                                     
  15.    byte const bitMask[8]={1,2,4,8,16,32,64,128};    //Variables para mascara  
  16.    byte const ByteDatosSalida[3]={0b11110010,       //Datos a mostrar en cada 74164  
  17.                                   0b11011010,    
  18.                                   0b01100000};
  19.    while(true){                                    
  20.       while(i<3){                                   //Ciclo de recorrido de los tres 74164
  21.          valor=ByteDatosSalida[i];                  //Intercambio de variables
  22.          for(j=0;j<8;j++){                          //Rrecorrido de cada bit del 74164
  23.             output_low(CLK);                        //Clock a nivel bajo  
  24.             output_bit(DATO,valor&bitMask[j]);      //Salida de dato para 74164 con aplicación de mascara "&"
  25.             delay_ms(30);                           //Demora de carga de datos
  26.             output_high(CLK);                       //Clock a nivel alto
  27.          }i++;                                      //Incremento del contador del while
  28.       }
  29.    }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment