Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <REG552.H>
- int hex(int frequenz){
- frequenz = 2^16 - 500000/frequenz;
- return frequenz;
- }
- void noteC(int wieoft){
- int i;
- for (i = 0; i<wieoft; i++){
- P1 =~P1;
- TR0=0;
- TF0=0;
- TH0=0xF8;
- TL0=0x84;
- TR0=1;
- while(TF0==0);
- }
- }
- void noteA(int wieoft){
- int i;
- for (i = 0; i<wieoft; i++){
- P1 =~P1;
- TR0=0;
- TF0=0;
- TH0=0xFB;
- TL0=0x8F;
- TR0=1;
- while(TF0==0);
- }
- }
- void noteD(int wieoft){
- int i;
- for (i = 0; i<wieoft; i++){
- P1 =~P1;
- TR0=0;
- TF0=0;
- TH0=0xF9;
- TL0=0x5B;
- TR0=1;
- while(TF0==0);
- }
- }
- void noteF(int wieoft){
- int i;
- for (i = 0; i<wieoft; i++){
- P1 =~P1;
- TR0=0;
- TF0=0;
- TH0=0xFA;
- TL0=0x67;
- TR0=1;
- while(TF0==0);
- }
- }
- void notecH(int wieoft){
- int i;
- for (i = 0; i<wieoft; i++){
- P1 =~P1;
- TR0=0;
- TF0=0;
- TH0=0xFC;
- TL0=0x44;
- TR0=1;
- while(TF0==0);
- }
- }
- void main (void)
- {
- int delay;
- const int c = 261;
- const int d = 294;
- const int e = 329;
- const int f = 349;
- const int g = 391;
- const int gS = 415;
- const int a = 440;
- const int aS = 455;
- const int b = 466;
- const int cH = 523;
- const int cSH = 554;
- const int dH = 587;
- const int dSH = 622;
- const int eH = 659;
- const int fH = 698;
- const int fSH = 740;
- const int gH = 784;
- const int gSH = 830;
- const int aH = 880;
- while(1){
- TMOD = 0x01;
- noteA(440);
- for(delay = 0; delay < 5000;delay++);
- noteA(440);
- for(delay = 0; delay < 5000;delay++);
- noteA(440);
- noteF(244);
- notecH(131);
- noteA(440);
- noteF(244);
- notecH(131);
- noteA(572);
- for(delay = 0; delay < 30000;delay++);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement