Advertisement
Guest User

Ultrasonic_levitation_G1.1

a guest
Apr 23rd, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pic 16 1.62 KB | None | 0 0
  1. #include <16F886.h>
  2. #device ADC=10 *=16
  3.  
  4. #FUSES NOWDT                    //No Watch Dog Timer
  5. #FUSES PUT                      //Power Up Timer
  6. #FUSES NOMCLR                   //Master Clear pin not enabled
  7. #FUSES NOPROTECT                //Code not protected from reading
  8. #FUSES NOCPD                    //No EE protection
  9. #FUSES BROWNOUT                 //Brownout reset
  10. #FUSES IESO                     //Internal External Switch Over mode enabled
  11. #FUSES FCMEN                    //Fail-safe clock monitor enabled
  12. #FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
  13. #FUSES NODEBUG                  //No Debug mode for ICD
  14. #FUSES NOWRT                    //Program memory not write protected
  15. #FUSES BORV40                   //Brownout reset at 4.0V
  16. #FUSES RESERVED                 //Used to set the reserved FUSE bits
  17. #FUSES INTRC_IO
  18.  
  19. #use delay(clock=8M)
  20.  
  21. #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
  22.  
  23. #define RUN_BUTTON   PIN_B7
  24.  
  25. int counter=0;
  26.  
  27. #INT_RB
  28. #INT_TIMER1
  29. void timer1_isr(){
  30. set_timer1(63936);
  31. counter=1;
  32.  
  33. // ?????????????? ISR ???? ?????????????????????
  34. }
  35. //!int i =0;
  36. void main() {
  37. int a=0,b=0;
  38. // ?????????? = 100 ms
  39. setup_timer_1(T1_INTERNAL | T1_DIV_BY_1);
  40. set_timer1(63936);
  41. enable_interrupts(INT_TIMER1);
  42. enable_interrupts(GLOBAL);
  43. while (1) {
  44.    
  45.    if (input(PIN_A2)){//left button
  46.    output_high(PIN_B2);
  47.    delay_ms(250);
  48.    output_low(PIN_B2);
  49.    
  50.    //rotated left
  51.   }if (input(PIN_A3)){//left button
  52.    output_high(PIN_B1);
  53.    delay_ms(250);
  54.    output_low(PIN_B1);
  55.    
  56.    //rotated left
  57.   }
  58.  
  59.    }
  60.  
  61.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement