Advertisement
Guest User

main.c

a guest
Oct 23rd, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <main.h>
  2. #include <math.h>
  3. unsigned int16 temp,a,b;
  4. #include "convert.c"
  5.  
  6. float c,d;
  7.  
  8. #int_timer0
  9. void ngat(void)
  10. {
  11. set_timer0(245);
  12. temp+=1;
  13. if (temp==1310)
  14. {
  15. temp=0;
  16. output_high(PIN_A0);
  17. output_high(PIN_A1);
  18. }
  19. if(temp== a)
  20. {
  21. output_low(PIN_A0);
  22. }
  23. if (temp== b)
  24. {
  25. output_low(PIN_A1);
  26. }
  27. }
  28.  
  29. void main()
  30. {
  31. setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4|RTCC_8_bit); //1.6 ms overflow
  32.  
  33. // enable_interrupts(INT_timer0);
  34. enable_interrupts(GLOBAL);
  35.  
  36. while(TRUE)
  37. {
  38. for (c=6;c<=29;c+=0.01)
  39. {
  40. d=6*sin(c)+13;
  41. convert(c,d);
  42. }
  43. for (c=29;c>=6;c-=0.01)
  44. {
  45. d=6*sin(c)+13;
  46. convert(c,d);
  47. }
  48.  
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement