fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // Tu secuencia exacta: 0, 2, 4, 6, 7, 5, 3, 1
  5. int secuencia[] = {0, 2, 4, 6, 7, 5, 3, 1};
  6. int totalPasos = 8;
  7.  
  8. printf("=== SIMULACION DE BITS PARA EL DECODIFICADOR 74LS48 ===\n\n");
  9. printf("Paso\tNumero\tBit C\tBit B\tBit A\t(Conexiones al 74LS48)\n");
  10. printf("------------------------------------------------------\n");
  11.  
  12. // Recorremos los 8 pasos de la secuencia
  13. for (int i = 0; i < totalPasos; i++) {
  14. int numeroActual = secuencia[i];
  15.  
  16. // Descomponemos el número en sus 3 bits binarios usando operaciones de bits
  17. int bitA = (numeroActual >> 0) & 0x01; // Bit menos significativo (Pin 7)
  18. int bitB = (numeroActual >> 1) & 0x01; // Bit del medio (Pin 1)
  19. int bitC = (numeroActual >> 2) & 0x01; // Bit más significativo (Pin 2)
  20.  
  21. // Mostramos el resultado en la consola de Ideone
  22. printf("[%d]\t %d\t %d\t %d\t %d\n", i + 1, numeroActual, bitC, bitB, bitA);
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
=== SIMULACION DE BITS PARA EL DECODIFICADOR 74LS48 ===

Paso	Numero	Bit C	Bit B	Bit A	(Conexiones al 74LS48)
------------------------------------------------------
[1]	  0	  0	  0	  0
[2]	  2	  0	  1	  0
[3]	  4	  1	  0	  0
[4]	  6	  1	  1	  0
[5]	  7	  1	  1	  1
[6]	  5	  1	  0	  1
[7]	  3	  0	  1	  1
[8]	  1	  0	  0	  1