jueves, 8 de marzo de 2012

2. CONSECUCION DE LOS COMPONENTES.

HERRAMIENTAS Y MATERIALES
                                                                                               
 
Descripción                               Cantidad
Pic 18f4550                                                       01
Motor paso a paso                                         01
Transformador de 110v a 12v                       01
Transistores BD136                                       04
BS548                                                               04
Diodos 1n4004.                                               08
Resistencias varios valores                          32
Potenciómetros.                                             01
Diodos leds                                                   05
Regulador 7805.                                            02
Compuertas lógicas.                                      02
LCD.                                                                01
Condensadores 220nf a 150V                      02
Triac BT 137.                                                 02
Moc 3021                                                       02
Focos de luz.                                                 02
Foto celda.                                                     01
Diodo laser.                                                   01       
Protoboard                                                     01
Caimanes.                                                       02
Multimetro Digital.                                       01

  Programa Control del motor elaborado en  MPLAB


#include <18F4550.h>
#device adc=10
#include <usb_bootloader.h>
#fuses PLL1,CPUDIV4,USBDIV,HSPLL,FCMEN,IESO,PUT,BROWNOUT_SW,BORV20,VREGEN
#fuses NOWDT,WDT32768,CCP2C1,NOPBADEN,LPT1OSC,MCLR,STVREN,NOLVP,NOXINST
#fuses NOPROTECT,NOCPB,NOCPD,NOWRT,NOWRTC,NOWRTB,NOWRTD,NOEBTR,NOEBTRB
#use delay(clock=16000000)
#ZERO_RAM


#define LCD_DATA_PORT getenv("SFR:PORTB")
#include <lcd.c>
void main()
{
set_tris_a(0b00001000);
set_tris_d(0b00000000);
set_tris_b(0b00000000);
set_tris_c(0b00000000);
set_tris_e(0b00000001);

 output_low(pin_c0);
 output_low(pin_c1);
 output_low(pin_c7);
 output_low(pin_c6);
 output_low(pin_d0);
 output_low(pin_d1);
 lcd_init();
inicio:

 lcd_gotoxy(1,1);
 lcd_putc("   PARKING OF   ");
 lcd_gotoxy(1,2);
 lcd_putc("      CARS      ");
if(input_state(pin_a3)==1)// ACTIVACION DEL PULSO QUE ENVIA LAS COMPUERTAS LOGICAS

 {
 output_high(pin_d0);// PULSO ENVIADO PARA ACTIVAR PRIMERA BOMBILLA, VA AL MOC
 lcd_putc('\f');
 lcd_putc(" BIENVENIDO  AL ");
 lcd_gotoxy(1,2);
 lcd_putc(" PARKING  CAR'S ");

 output_high(pin_c7);// CONTROL MOTOR PASO A PASO
 delay_ms(350);
 output_low(pin_c7);
 output_high(pin_c1);
 delay_ms(350);
 output_low(pin_c1);
 output_high(pin_c0);
 delay_ms(350);
 output_low(pin_c0);
 output_high(pin_c6);
 delay_ms(350);
 output_low(pin_c6);
 output_high(pin_c7);
 delay_ms(350);
 output_low(pin_c7);
 output_high(pin_c1);
 delay_ms(350);
 output_low(pin_c1);
 output_high(pin_c0);
 delay_ms(350);
 output_low(pin_c0);
 output_high(pin_c6);
 delay_ms(350);
 output_low(pin_c6);
 output_high(pin_c7);
 delay_ms(350);
 output_low(pin_c7);
 output_high(pin_c1);
 delay_ms(350);
 output_low(pin_c1);
 output_high(pin_c0);
 delay_ms(350);

 output_low(pin_c0);
 output_high(pin_c6);
 delay_ms(350);
 output_low(pin_c6);
 output_high(pin_c7);
 delay_ms(350);
 output_low(pin_c7);
 output_high(pin_c1);
 delay_ms(350);
 output_low(pin_c1);
 output_high(pin_c0);
 output_low(pin_c0);
  delay_ms(6000);
 output_high(pin_d1);// PRENDE SEGUNDO BOMBILLO, PULSO AL SEGUNDO MOC

 output_high(pin_c0);
 delay_ms(350);
 output_low(pin_c0);
 output_high(pin_c1);
 delay_ms(350);
 output_low(pin_c1);
 output_high(pin_c7);
 delay_ms(350);
 output_low(pin_c7);
 output_high(pin_c6);
 delay_ms(350);
 output_low(pin_c6);
 output_high(pin_c0);
 delay_ms(350);
 output_low(pin_c0);
 output_high(pin_c1);
 delay_ms(350);
 output_low(pin_c1);
 output_high(pin_c7);
 delay_ms(350);
 output_low(pin_c7);
 output_high(pin_c6);
 delay_ms(350);
 output_low(pin_c6);

 output_high(pin_c0);
 delay_ms(350);
 output_low(pin_c0);
 output_high(pin_c1);
 delay_ms(350);
 output_low(pin_c1);
 output_high(pin_c7);
 delay_ms(350);
 output_low(pin_c7);
 output_high(pin_c6);
 delay_ms(350);
 output_low(pin_c6);

 output_high(pin_c0);
 delay_ms(350);
 output_low(pin_c0);
 output_high(pin_c1);
 delay_ms(350);
 output_low(pin_c1);
 output_high(pin_c7);
 delay_ms(350);
 output_low(pin_c7);
 output_high(pin_c6);
 output_low(pin_c6);

 lcd_putc('\f');
 output_low(pin_d0);// APAGA BOMBILLA No. 1

 lcd_gotoxy(1,1);
 lcd_putc("   PARKING OF   ");
 lcd_gotoxy(1,2);
 lcd_putc("      CARS      ");
 delay_ms(4000);
 output_low(pin_d1);// APAGA BOMBILLA No. 2

goto inicio;

 }
else
 {
goto inicio;
 }

}

DATASHEET BT137



















DATASHEET MOC 3021










 3. ENSAYO EN LA PROTOBOARD.



No hay comentarios:

Publicar un comentario