miguelmarve

manejo de electrovalvulas

Sep 29th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include <16F877A.h>
  2. #FUSES NOWDT                    //No Watch Dog Timer
  3. #FUSES XT                       //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
  4. #FUSES NOBROWNOUT               //No brownout reset
  5. #FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
  6. #use delay(clock=4000000)
  7. void main()
  8. {
  9. int inicio,aux;;//senales de los sensores
  10. set_tris_b(0x00);//El puerto B cuenta con 8 pines, todas a salidas.
  11. while (TRUE)
  12. {
  13. aux=1;
  14. output_B(0x00);//reinicia el sistema,ademas por seguridad
  15. inicio=input(PIN_D2);
  16. switch (inicio)
  17. {
  18. case 1:
  19. delay_ms(500);
  20. output_B(0b00000010);//salen A+ y B+ al mismo tiempo
  21. delay_ms(3000);
  22. output_B(0b00000100);//salen C y se mantiene A y B
  23. delay_ms(3000);
  24. output_B(0b0000010);//salen Regresa C y se mantiene A y B
  25. delay_ms(3000);
  26. output_B(0b0000001);//Regresa A y B
  27. delay_ms(3000);
  28. output_B(0x00);
  29. delay_ms(500);
  30. break;
  31. case 0:output_B(0x00);//manda cero a todo
  32. delay_ms(2000);break;
  33. default:break;
  34. }
  35.  
  36. }
  37. }//fin del cuerpo{}
Advertisement
Add Comment
Please, Sign In to add comment