Advertisement
Guest User

JaMAFERTIG!

a guest
Dec 13th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #include <REG552.H>
  2.  
  3. int hex(int frequenz){
  4. frequenz = 2^16 - 500000/frequenz;
  5. return frequenz;
  6. }
  7.  
  8. void noteC(int wieoft){
  9. int i;
  10. for (i = 0; i<wieoft; i++){
  11. P1 =~P1;
  12. TR0=0;
  13. TF0=0;
  14. TH0=0xF8;
  15. TL0=0x84;
  16. TR0=1;
  17. while(TF0==0);
  18. }
  19. }
  20. void noteA(int wieoft){
  21. int i;
  22. for (i = 0; i<wieoft; i++){
  23. P1 =~P1;
  24. TR0=0;
  25. TF0=0;
  26. TH0=0xFB;
  27. TL0=0x8F;
  28. TR0=1;
  29. while(TF0==0);
  30. }
  31. }
  32. void noteD(int wieoft){
  33. int i;
  34. for (i = 0; i<wieoft; i++){
  35. P1 =~P1;
  36. TR0=0;
  37. TF0=0;
  38. TH0=0xF9;
  39. TL0=0x5B;
  40. TR0=1;
  41. while(TF0==0);
  42. }
  43. }
  44. void noteF(int wieoft){
  45. int i;
  46. for (i = 0; i<wieoft; i++){
  47. P1 =~P1;
  48. TR0=0;
  49. TF0=0;
  50. TH0=0xFA;
  51. TL0=0x67;
  52. TR0=1;
  53. while(TF0==0);
  54. }
  55. }
  56. void notecH(int wieoft){
  57. int i;
  58. for (i = 0; i<wieoft; i++){
  59. P1 =~P1;
  60. TR0=0;
  61. TF0=0;
  62. TH0=0xFC;
  63. TL0=0x44;
  64. TR0=1;
  65. while(TF0==0);
  66. }
  67. }
  68. void main (void)
  69. {
  70. int delay;
  71. const int c = 261;
  72. const int d = 294;
  73. const int e = 329;
  74. const int f = 349;
  75. const int g = 391;
  76. const int gS = 415;
  77. const int a = 440;
  78. const int aS = 455;
  79. const int b = 466;
  80. const int cH = 523;
  81. const int cSH = 554;
  82. const int dH = 587;
  83. const int dSH = 622;
  84. const int eH = 659;
  85. const int fH = 698;
  86. const int fSH = 740;
  87. const int gH = 784;
  88. const int gSH = 830;
  89. const int aH = 880;
  90.  
  91.  
  92. while(1){
  93. TMOD = 0x01;
  94. noteA(440);
  95. for(delay = 0; delay < 5000;delay++);
  96. noteA(440);
  97. for(delay = 0; delay < 5000;delay++);
  98. noteA(440);
  99. noteF(244);
  100. notecH(131);
  101. noteA(440);
  102. noteF(244);
  103. notecH(131);
  104. noteA(572);
  105. for(delay = 0; delay < 30000;delay++);
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement