aleda5859 Inserito: 19 settembre 2004 Segnala Share Inserito: 19 settembre 2004 Salve a tutti... sono tornato Avrei bisogno di costruire un metronomo con un uscita cuffie e magari un display a 7 segmenti che conti i battiti [ 1...2...3...4 ...1...2...ecc..]Avete qualche idea o schema per caso?Vorrei alimentarlo a batteria. Link al commento Condividi su altri siti More sharing options...
luciano Inserita: 19 settembre 2004 Segnala Share Inserita: 19 settembre 2004 ciao io l'ho fatto e' programmabbile fino a 13 battuteluc Link al commento Condividi su altri siti More sharing options...
aleda5859 Inserita: 19 settembre 2004 Autore Segnala Share Inserita: 19 settembre 2004 Felice di sapere che tu l'abbia costruito.. non è che potresti passarmi qualche schema? o consiglio ?In sostanza dovrei creare un'onda quadra corrispondente ad un certo clock che permetterà di emettere il suono.Questo posso farlo con gli integrati ma il suono come lo faccio uscire? Link al commento Condividi su altri siti More sharing options...
luciano Inserita: 22 settembre 2004 Segnala Share Inserita: 22 settembre 2004 io non mi sono occupato della parte della generazione del suono .. per quello ci ha pensato il mio collega.io mi sono occupato del software e dell ardware ...il programma l'ho realizzato in C : //****************************************************************************** // Title MAIN PROGRAM // Program PTP052A100 // File MAIN.C // Date 22/06/2004 // Programmer //****************************************************************************** //------------------------------------------------------------------------------ // INCLUSIONE FILES //------------------------------------------------------------------------------ // Inclusioni files libreria funzioni C. // Inclusione file definizioni. #include "c:\fsi\inc\math.h" #include "defn.h" //#include "pid.h" //------------------------------------------------------------------------------ // DEFINIZIONI INTERNE //------------------------------------------------------------------------------ // Definizioni generali. //#define PWMCYCLE 5000 //periodo PWM out (mSec) // Definizioni dei prototipi delle funzioni interne. void main(void) { // Definizione variabili interne. // static BYTEBIT outputs; //buffer gestione uscite logiche // static unsigned int pwmon; //buffer start tempo ciclo PWM // static float pwmduty; //tempo di durata pwm // unsigned int i; //buffer spare //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Eseguo gestione uscite logiche. float base; unsigned int temp; // register unsigned int i; long er;//unsigned int er; unsigned int aa; unsigned int aa60; unsigned int aa82; unsigned int aa83; unsigned int aa84; unsigned int aa85; unsigned int aa86; unsigned int aa87; unsigned int aa88; unsigned int aa89; unsigned int aa8a; unsigned int aa8b; unsigned int aa8c; unsigned int aa8d; //float y; //int prova; //int primo; //float secondo; //float corr; //base = 2.0; //power = 8.0; //y = pow (base, power); //y = base*power; /* y = 256 */ // mi cancella tutti i byte da y 80 fino a y 9f // inizializzazioni :::: temp = 0; if ((*(unsigned int xdata *) 0xE894) >= 21) (*(unsigned int xdata *) 0xE894) = 2; if ((*(unsigned int xdata *) 0xE890) >= 14) (*(unsigned int xdata *) 0xE890) = 2; if ((*(unsigned int xdata *) 0xE892) >= 14) (*(unsigned int xdata *) 0xE892) = 2; if ((*(unsigned int xdata *) 0xE894) <= 1) (*(unsigned int xdata *) 0xE894) = 2; if ((*(unsigned int xdata *) 0xE890) <= 1) (*(unsigned int xdata *) 0xE890) = 2; if ((*(unsigned int xdata *) 0xE892) <= 1) (*(unsigned int xdata *) 0xE892) = 2; (*(unsigned int xdata *) 0xE3A8) = (*(unsigned int xdata *) 0xE3A8) + 1; if ((*(unsigned int xdata *) 0xE3A8)>(*(unsigned int xdata *) 0xE894)) (*(unsigned int xdata *) 0xE3A8)=1; if ((*(unsigned int xdata *) 0xE3A8)==1) { (*(unsigned int xdata *) 0xE360) =(*(unsigned int xdata *) 0xE360) +1; if ((*(unsigned int xdata *) 0xE360) >= 101) (*(unsigned int xdata *) 0xE360) =1; } base = 0.4; // base = 0.4 + ((*(unsigned int xdata *) 0xE894)-1) * 0.2; // if ((*(unsigned int xdata *) 0xE894) == 1) // base = 0.4; // if ((*(unsigned int xdata *) 0xE894) == 2) // base = 0.6; // if ((*(unsigned int xdata *) 0xE894) == 3) // base = 0.8; // if ((*(unsigned int xdata *) 0xE894) == 4) // base = 1; // if ((*(unsigned int xdata *) 0xE894) == 5) // base = 1.2; // if ((*(unsigned int xdata *) 0xE894) == 6) // base = 1.4; // if ((*(unsigned int xdata *) 0xE894) == 7) // base = 1.6; // if ((*(unsigned int xdata *) 0xE894) == 8) // base = 1.8; // if ((*(unsigned int xdata *) 0xE894) == 9) // base = 2; // if ((*(unsigned int xdata *) 0xE894) == 10) // base = 2.2; // if ((*(unsigned int xdata *) 0xE894) == 11) // base = 2.4; // if ((*(unsigned int xdata *) 0xE894) == 12) // base = 2.6; // if ((*(unsigned int xdata *) 0xE894) == 13) // base = 2.8; // if ((*(unsigned int xdata *) 0xE894) == 14) // base = 3; // if ((*(unsigned int xdata *) 0xE894) == 15) // base = 3.2; // if ((*(unsigned int xdata *) 0xE894) == 16) // base = 3.4; // if ((*(unsigned int xdata *) 0xE894) == 17) // base = 3.6; // if ((*(unsigned int xdata *) 0xE894) == 18) // base = 3.8; // if ((*(unsigned int xdata *) 0xE894) == 19) // base = 4; // if ((*(unsigned int xdata *) 0xE894) == 20) // base = 4.2; /// base = (float)((*(unsigned int xdata *) 0xE894)-1)*2/10; //(*(unsigned int xdata *) 0xE896)=base;// CIFRA A SINISTRA DELLA VIRGOLA //(*(unsigned int xdata *) 0xE898)=(base * 10 - (*(unsigned int xdata *) 0xE896)*10);// CIFRA A DESTRA DELLA VIRGOLA (*(unsigned char xdata *) 0xE380) = 0;//spengo (*(unsigned char xdata *) 0xE381) = 0;//spengo (*(unsigned char xdata *) 0xE382) = 0;//spengo (*(unsigned char xdata *) 0xE383) = 0;//spengo (*(unsigned char xdata *) 0xE384) = 0;//spengo (*(unsigned char xdata *) 0xE385) = 0;//spengo (*(unsigned char xdata *) 0xE386) = 0;//spengo (*(unsigned char xdata *) 0xE387) = 0;//spengo (*(unsigned char xdata *) 0xE388) = 0;//spengo (*(unsigned char xdata *) 0xE389) = 0;//spengo (*(unsigned char xdata *) 0xE38A) = 0;//spengo (*(unsigned char xdata *) 0xE38B) = 0;//spengo (*(unsigned char xdata *) 0xE38C) = 0;//spengo (*(unsigned char xdata *) 0xE38D) = 0;//spengo (*(unsigned char xdata *) 0xE310) = 0;//spengo (*(unsigned char xdata *) 0xE311) = 0;//spengo (*(unsigned char xdata *) 0xE312) = 0;//spengo if ((*(unsigned int xdata *) 0xE360)==100) { (*(unsigned char xdata *) 0xE310)=1; //accendo la base if ((*(unsigned int xdata *) 0xE890)==0); else (*(unsigned char xdata *) 0xE311)=1; //accendo la base if ((*(unsigned int xdata *) 0xE892)==0); else (*(unsigned char xdata *) 0xE312)=1; //accendo la base } aa = (*(unsigned int xdata *) 0xE890); // temp = 0; xx: if (aa>=2) { if (aa==2) //duina (*(unsigned char xdata *) 0xE382)=50; if (aa==3) {//terzina (*(unsigned char xdata *) 0xE382)=33; (*(unsigned char xdata *) 0xE383)=66; } if (aa==4) {//quartina (*(unsigned char xdata *) 0xE382)=25; (*(unsigned char xdata *) 0xE383)=50; (*(unsigned char xdata *) 0xE384)=75; } if (aa==5) {// (*(unsigned char xdata *) 0xE382)=20; (*(unsigned char xdata *) 0xE383)=40; (*(unsigned char xdata *) 0xE384)=60; (*(unsigned char xdata *) 0xE385)=80; } if (aa==6) {// (*(unsigned char xdata *) 0xE382)=16; (*(unsigned char xdata *) 0xE383)=33; (*(unsigned char xdata *) 0xE384)=50; (*(unsigned char xdata *) 0xE385)=66; (*(unsigned char xdata *) 0xE386)=83; } if (aa==7) {// (*(unsigned char xdata *) 0xE382)=14; (*(unsigned char xdata *) 0xE383)=28; (*(unsigned char xdata *) 0xE384)=42; (*(unsigned char xdata *) 0xE385)=57; (*(unsigned char xdata *) 0xE386)=71; (*(unsigned char xdata *) 0xE387)=85; } if (aa==8) {// (*(unsigned char xdata *) 0xE382)=12; (*(unsigned char xdata *) 0xE383)=25; (*(unsigned char xdata *) 0xE384)=37; (*(unsigned char xdata *) 0xE385)=50; (*(unsigned char xdata *) 0xE386)=62; (*(unsigned char xdata *) 0xE387)=75; (*(unsigned char xdata *) 0xE388)=87; } if (aa==9) {// (*(unsigned char xdata *) 0xE382)=11; (*(unsigned char xdata *) 0xE383)=22; (*(unsigned char xdata *) 0xE384)=33; (*(unsigned char xdata *) 0xE385)=44; (*(unsigned char xdata *) 0xE386)=55; (*(unsigned char xdata *) 0xE387)=66; (*(unsigned char xdata *) 0xE388)=77; (*(unsigned char xdata *) 0xE389)=88; } if (aa==10) {// (*(unsigned char xdata *) 0xE382)=10; (*(unsigned char xdata *) 0xE383)=20; (*(unsigned char xdata *) 0xE384)=30; (*(unsigned char xdata *) 0xE385)=40; (*(unsigned char xdata *) 0xE386)=50; (*(unsigned char xdata *) 0xE387)=60; (*(unsigned char xdata *) 0xE388)=70; (*(unsigned char xdata *) 0xE389)=80; (*(unsigned char xdata *) 0xE38A)=90; } if (aa==11) {// (*(unsigned char xdata *) 0xE382)=9; (*(unsigned char xdata *) 0xE383)=18; (*(unsigned char xdata *) 0xE384)=27; (*(unsigned char xdata *) 0xE385)=36; (*(unsigned char xdata *) 0xE386)=45; (*(unsigned char xdata *) 0xE387)=54; (*(unsigned char xdata *) 0xE388)=63; (*(unsigned char xdata *) 0xE389)=72; (*(unsigned char xdata *) 0xE38A)=81; (*(unsigned char xdata *) 0xE38B)=90; } if (aa==12) {// (*(unsigned char xdata *) 0xE382)=8; (*(unsigned char xdata *) 0xE383)=16; (*(unsigned char xdata *) 0xE384)=25; (*(unsigned char xdata *) 0xE385)=33; (*(unsigned char xdata *) 0xE386)=41; (*(unsigned char xdata *) 0xE387)=50; (*(unsigned char xdata *) 0xE388)=58; (*(unsigned char xdata *) 0xE389)=66; (*(unsigned char xdata *) 0xE38A)=75; (*(unsigned char xdata *) 0xE38B)=83; (*(unsigned char xdata *) 0xE38C)=91; } //goto xx if (aa==13) {//tredicina (*(unsigned char xdata *) 0xE382)=7; (*(unsigned char xdata *) 0xE383)=15; (*(unsigned char xdata *) 0xE384)=23; (*(unsigned char xdata *) 0xE385) = 30;//spengo (*(unsigned char xdata *) 0xE386) = 38;//spengo (*(unsigned char xdata *) 0xE387) = 46;//spengo (*(unsigned char xdata *) 0xE388) = 53;//spengo (*(unsigned char xdata *) 0xE389) = 61;//spengo (*(unsigned char xdata *) 0xE38A) = 69;//spengo (*(unsigned char xdata *) 0xE38B) = 76;//spengo (*(unsigned char xdata *) 0xE38C) = 84;//spengo (*(unsigned char xdata *) 0xE38D) = 92;//spengo } //goto xx; } aa60 = (*(unsigned int xdata *) 0xE360); aa82 = (*(unsigned char xdata *) 0xE382); aa83 = (*(unsigned char xdata *) 0xE383); aa84 = (*(unsigned char xdata *) 0xE384); aa85 = (*(unsigned char xdata *) 0xE385); aa86 = (*(unsigned char xdata *) 0xE386); aa87 = (*(unsigned char xdata *) 0xE387); aa88 = (*(unsigned char xdata *) 0xE388); aa89 = (*(unsigned char xdata *) 0xE389); aa8a = (*(unsigned char xdata *) 0xE38A); aa8b = (*(unsigned char xdata *) 0xE38B); aa8c = (*(unsigned char xdata *) 0xE38C); aa8d = (*(unsigned char xdata *) 0xE38D); if (temp ==1) goto xx2; if (aa82==aa60||aa83==aa60||aa84==aa60||aa85==aa60||aa86==aa60||aa87==aa60||aa88==aa60||aa89==aa60) (*(unsigned char xdata *) 0xE311)=1; //accendo if (aa8a==aa60||aa8b==aa60||aa8c==aa60||aa8d==aa60) (*(unsigned char xdata *) 0xE311)=1; //accendo temp = 1; aa = (*(unsigned int xdata *) 0xE892); // (*(unsigned char xdata *) 0xE380) = 0;//spengo (*(unsigned char xdata *) 0xE381) = 0;//spengo (*(unsigned char xdata *) 0xE382) = 0;//spengo (*(unsigned char xdata *) 0xE383) = 0;//spengo (*(unsigned char xdata *) 0xE384) = 0;//spengo (*(unsigned char xdata *) 0xE385) = 0;//spengo (*(unsigned char xdata *) 0xE386) = 0;//spengo (*(unsigned char xdata *) 0xE387) = 0;//spengo (*(unsigned char xdata *) 0xE388) = 0;//spengo (*(unsigned char xdata *) 0xE389) = 0;//spengo (*(unsigned char xdata *) 0xE38A) = 0;//spengo (*(unsigned char xdata *) 0xE38B) = 0;//spengo (*(unsigned char xdata *) 0xE38C) = 0;//spengo (*(unsigned char xdata *) 0xE38D) = 0;//spengo goto xx; //**************************************************************************************************+ //**************************************************************************************************+ //**************************************************************************************************+ //**************************************************************************************************+ // aa = (*(unsigned int xdata *) 0xE892); // // // (*(unsigned char xdata *) 0xE380) = 0;//spengo // (*(unsigned char xdata *) 0xE381) = 0;//spengo // (*(unsigned char xdata *) 0xE382) = 0;//spengo // (*(unsigned char xdata *) 0xE383) = 0;//spengo // (*(unsigned char xdata *) 0xE384) = 0;//spengo // (*(unsigned char xdata *) 0xE385) = 0;//spengo // (*(unsigned char xdata *) 0xE386) = 0;//spengo // (*(unsigned char xdata *) 0xE387) = 0;//spengo // (*(unsigned char xdata *) 0xE388) = 0;//spengo // (*(unsigned char xdata *) 0xE389) = 0;//spengo // (*(unsigned char xdata *) 0xE38A) = 0;//spengo // (*(unsigned char xdata *) 0xE38B) = 0;//spengo // (*(unsigned char xdata *) 0xE38C) = 0;//spengo // (*(unsigned char xdata *) 0xE38D) = 0;//spengo // // // if (aa>=2) // { // if (aa==2) //duina // (*(unsigned char xdata *) 0xE382)=50; // if (aa==3) {//terzina // (*(unsigned char xdata *) 0xE382)=33; // (*(unsigned char xdata *) 0xE383)=66; // } // if (aa==4) {//quartina // (*(unsigned char xdata *) 0xE382)=25; // (*(unsigned char xdata *) 0xE383)=50; // (*(unsigned char xdata *) 0xE384)=75; // } // // if (aa==5) {// // (*(unsigned char xdata *) 0xE382)=20; // (*(unsigned char xdata *) 0xE383)=40; // (*(unsigned char xdata *) 0xE384)=60; // (*(unsigned char xdata *) 0xE385)=80; // } // // if (aa==6) {// // (*(unsigned char xdata *) 0xE382)=16; // (*(unsigned char xdata *) 0xE383)=33; // (*(unsigned char xdata *) 0xE384)=50; // (*(unsigned char xdata *) 0xE385)=66; // (*(unsigned char xdata *) 0xE386)=83; // } // if (aa==7) {// // (*(unsigned char xdata *) 0xE382)=14; // (*(unsigned char xdata *) 0xE383)=28; // (*(unsigned char xdata *) 0xE384)=42; // (*(unsigned char xdata *) 0xE385)=57; // (*(unsigned char xdata *) 0xE386)=71; // (*(unsigned char xdata *) 0xE387)=85; // } // if (aa==8) {// // (*(unsigned char xdata *) 0xE382)=12; // (*(unsigned char xdata *) 0xE383)=25; // (*(unsigned char xdata *) 0xE384)=37; // (*(unsigned char xdata *) 0xE385)=50; // (*(unsigned char xdata *) 0xE386)=62; // (*(unsigned char xdata *) 0xE387)=75; // (*(unsigned char xdata *) 0xE388)=87; // } // if (aa==9) {// // (*(unsigned char xdata *) 0xE382)=11; // (*(unsigned char xdata *) 0xE383)=22; // (*(unsigned char xdata *) 0xE384)=33; // (*(unsigned char xdata *) 0xE385)=44; // (*(unsigned char xdata *) 0xE386)=55; // (*(unsigned char xdata *) 0xE387)=66; // (*(unsigned char xdata *) 0xE388)=77; // (*(unsigned char xdata *) 0xE389)=88; // } // if (aa==10) {// // (*(unsigned char xdata *) 0xE382)=10; // (*(unsigned char xdata *) 0xE383)=20; // (*(unsigned char xdata *) 0xE384)=30; // (*(unsigned char xdata *) 0xE385)=40; // (*(unsigned char xdata *) 0xE386)=50; // (*(unsigned char xdata *) 0xE387)=60; // (*(unsigned char xdata *) 0xE388)=70; // (*(unsigned char xdata *) 0xE389)=80; // (*(unsigned char xdata *) 0xE38A)=90; // } // if (aa==11) {// // (*(unsigned char xdata *) 0xE382)=9; // (*(unsigned char xdata *) 0xE383)=18; // (*(unsigned char xdata *) 0xE384)=27; // (*(unsigned char xdata *) 0xE385)=36; // (*(unsigned char xdata *) 0xE386)=45; // (*(unsigned char xdata *) 0xE387)=54; // (*(unsigned char xdata *) 0xE388)=63; // (*(unsigned char xdata *) 0xE389)=72; // (*(unsigned char xdata *) 0xE38A)=81; // (*(unsigned char xdata *) 0xE38B)=90; // } // if (aa==12) {// // (*(unsigned char xdata *) 0xE382)=8; // (*(unsigned char xdata *) 0xE383)=16; // (*(unsigned char xdata *) 0xE384)=25; // (*(unsigned char xdata *) 0xE385)=33; // (*(unsigned char xdata *) 0xE386)=41; // (*(unsigned char xdata *) 0xE387)=50; // (*(unsigned char xdata *) 0xE388)=58; // (*(unsigned char xdata *) 0xE389)=66; // (*(unsigned char xdata *) 0xE38A)=75; // (*(unsigned char xdata *) 0xE38B)=83; // (*(unsigned char xdata *) 0xE38C)=91; // } // ////goto xx // if (aa==13) {//tredicina // (*(unsigned char xdata *) 0xE382)=7; // (*(unsigned char xdata *) 0xE383)=15; // (*(unsigned char xdata *) 0xE384)=23; // (*(unsigned char xdata *) 0xE385) = 30;//spengo // (*(unsigned char xdata *) 0xE386) = 38;//spengo // (*(unsigned char xdata *) 0xE387) = 46;//spengo // (*(unsigned char xdata *) 0xE388) = 53;//spengo // (*(unsigned char xdata *) 0xE389) = 61;//spengo // (*(unsigned char xdata *) 0xE38A) = 69;//spengo // (*(unsigned char xdata *) 0xE38B) = 76;//spengo // (*(unsigned char xdata *) 0xE38C) = 84;//spengo // (*(unsigned char xdata *) 0xE38D) = 92;//spengo // } ////goto xx; // } // aa60 = (*(unsigned int xdata *) 0xE360); // aa82 = (*(unsigned char xdata *) 0xE382); // aa83 = (*(unsigned char xdata *) 0xE383); // aa84 = (*(unsigned char xdata *) 0xE384); // aa85 = (*(unsigned char xdata *) 0xE385); // aa86 = (*(unsigned char xdata *) 0xE386); // aa87 = (*(unsigned char xdata *) 0xE387); // aa88 = (*(unsigned char xdata *) 0xE388); // aa89 = (*(unsigned char xdata *) 0xE389); // aa8a = (*(unsigned char xdata *) 0xE38A); // aa8b = (*(unsigned char xdata *) 0xE38B); // aa8c = (*(unsigned char xdata *) 0xE38C); // aa8d = (*(unsigned char xdata *) 0xE38D); xx2: if (aa82==aa60||aa83==aa60||aa84==aa60||aa85==aa60||aa86==aa60||aa87==aa60||aa88==aa60||aa89==aa60) (*(unsigned char xdata *) 0xE312)=1; //accendo if (aa8a==aa60||aa8b==aa60||aa8c==aa60||aa8d==aa60) (*(unsigned char xdata *) 0xE312)=1; //accendo } //fineeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee // [End of file]spero sia tutto chiaro Link al commento Condividi su altri siti More sharing options...
aleda5859 Inserita: 27 settembre 2004 Autore Segnala Share Inserita: 27 settembre 2004 Wow!Ti ringrazio ma io intendevo costruirlo elettronico.Già che ho aperto la discussione scrivo come ho definito la cosa tante volte dovesse servire a qualcuno.Con un NE555 ho fornito l'onda quadra per il "tic" del metronomo ovviamente regolabile in frequenza da un potenziomentro. Ho collegato poi questo circuitino ad un amplificatore per cuffie/casse dato che chi dovrà usare il metronomo lo vuole appunto "nell'orecchio" e bello sparato da lì ho colllegato l'entrata cuffie ed un piccolo altoparlante.Insieme ho collegto un transistor interruttore che grazie all'onda quadra dell'NE555 collegata alla base mi accende e spegne a tempo un led Flash blu.Infine per segnalare lo stadio di ON/OFF dell'apparecchio ho collegato all' swich di accensione un led rosso.Così ho ottenuto la segnalazione acustica della cassa ed in cuffia eventualmente con volume regolabile dal piccolo preamplificatore + la segnalazione visiva del Flash che si accende e si spegne a tempo.Se foste interessati vi posto alcune foto appena assemblo il tutto... ancora lavoro su breadboard.Ciao a tutti! Link al commento Condividi su altri siti More sharing options...
Messaggi consigliati
Crea un account o accedi per commentare
Devi essere un utente per poter lasciare un commento
Crea un account
Registrati per un nuovo account nella nostra comunità. è facile!
Registra un nuovo accountAccedi
Hai già un account? Accedi qui.
Accedi ora