mndrj

rf+openhab

Feb 22nd, 2018
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include<htc.h>
  2. __CONFIG(FOSC_HS & WDTE_OFF & PWRTE_OFF & BOREN_OFF & LVP_OFF & WRT_OFF & DEBUG_OFF & CP_ON);
  3. #define _XTAL_FREQ 11059200
  4. #define led RB0
  5. #define rf RD0
  6. #define esp RD1
  7. int flag=0;
  8.  
  9. main()
  10. {
  11. TRISB=0x00;
  12. TRISD=0xFF;
  13. led=0;
  14.  
  15. if(rf==1&&esp==1)
  16. {
  17. led=0;
  18. }
  19.  
  20. here:
  21. if(esp==0&&flag==0)
  22. {
  23. while(esp==0);
  24. led=1;
  25. //__delay_ms(100);
  26. flag=1;
  27.  
  28. /*if(rf==0&&flag==1)
  29. {
  30. while(rf==0);
  31. led=0;
  32. flag=0;
  33. }*/
  34. }
  35.  
  36. else if(esp==0&&flag==1)
  37. {
  38. while(esp==0);
  39. led=0;
  40. flag=0;
  41. }
  42. else if(rf==0&&flag==0)
  43. {
  44. while(rf==0);
  45. led=1;
  46. flag=1;
  47. }
  48. else if(rf==0&&flag==1)
  49. {
  50. while(rf==0);
  51. led=0;
  52. flag=0;
  53. }
  54.  
  55. //__delay_ms(100);
  56. goto here;
  57. }
Add Comment
Please, Sign In to add comment