miércoles, 19 de junio de 2013

RUTINA AUTO - FANTASTICO ( LAB - 2 )




IMPLEMENTACION DE LA RUTINA AUTO-FANTASTICO
MATERIALES:

·         PROTOBOARD
·         8 LED’S
·         8 RESISTENCIAS
·         MICROCONTROLADOR  18F2550

PROGRAMA:

#include<18F2550.h>
#fuses HS, NOWDT, NOPROTECT, NOLVP, NODEBUG, USBDIV, PLL3, CPUDIV1, VREGEN
#use  delay (clock=12000000)                                                                                                        // CRISTAL 12MHz

#use fast_IO   (B)

void main() {
     set_tris_B(0X00);                                                                          // PUERTO B DE SALIDA
   
     do {
        output_high(PIN_B0);                                                               // SE ENCIENDE EL LED
        delay_ms(100);                                                                             // RETARDO
        output_high(PIN_B1);                                                                   // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B2);                                                                     // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B3);                                                                   // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B4);                                                                // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B5);                                                                     // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B6);                                                                    // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B7);                                                                       // SE ENCIENDE EL LED
        delay_ms(100);
                             
        output_low(PIN_B0);                                                                     // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B1);                                                                     // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B2);                                                                      // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B3);                                                                       // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B4);                                                                        // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B5);                                                                       // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B6);                                                                    // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B7);                                                                    // SE APAGA EL LED
        delay_ms(100);
       
        output_high(PIN_B7);                                                                   // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B6);                                                                    // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B5);                                                               // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B4);                                                                     // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B3);                                                                      // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B2);                                                                      // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B1);                                                                     // SE ENCIENDE EL LED
        delay_ms(100);
        output_high(PIN_B0);                                                                    // SE ENCIENDE EL LED
        delay_ms(100);
       
        output_low(PIN_B7);                                                                       // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B6);                                                                      // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B5);                                                                       // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B4);                                                                      // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B3);                                                                      // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B2);                                                                      // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B1);                                                                      // SE APAGA EL LED
        delay_ms(100);
        output_low(PIN_B0);                                                                        // SE APAGA EL LED
        delay_ms(100);          
   }
     while(true);

}

DIAGRAMA DE FLUJO:



HARDWARE DEL CIRCUITO


No hay comentarios:

Publicar un comentario