tag:blogger.com,1999:blog-99429052024-03-13T16:16:06.532-07:00LISP mcmaxLISP and moreMassimo Spatarohttp://www.blogger.com/profile/14813354023913974275noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-9942905.post-17959616804618167492011-06-02T04:48:00.000-07:002011-06-02T05:27:48.423-07:00RS Servo Tester<span style="font-weight:bold;">Progetto per movimentare un servo RC da aeromodelli con un Pic 12F628A (8Pin) </span><br /><br />Il progetto è alquanto semplice usare un timer del pic per generare un PWM idoneo a controllare la posizione del servomotore. Il servo alla accensione si posiziona al centro della corsa e con due tasti Destro e Sinistro raggiunge la posizione -120° e +120°.<br />Alla pressione di ambedue i tasti ritorna alla posizione centrale.<br />Qualcuno mi ha domandato perchè non usare il PWM del Chip? La spiegazione è semplice i servi RC hanno una temporizzazione alquanto delicata e il PWM Hardware del pic non ha una risoluzione adeguata alla richiesta di posizionamento di precisione dei Servi RC digitali.<br />Quindi vista la velocità di esecuzione del microcodice dei pic e optando per un generatore di clock interno a 4mhz disponibile nel CHIP ( nessun quarzo esterno ) ho scritto il codice e mi sono messo a provarlo. Confesso che sono partito da una versione in basic scritta per PIC che funzionava alquanto male, della quale nel source OPEN ho mantenuto l'intestazione originale del writer. <br />Tradotto in "C" e corretto il codice, usando il timer il comparatore gli interrupt e un po di calcoli svolge splendidamente il suo lavoro. Ha una risoluzione di posizionamento dei contatori di 1microsecondo pari a circa 0,07° gradi, con i controllo tasti a 0,3° per step.<br />Il codice è scritto in MickroC che è free per impieghi con tutti i PIC 12/16/18/24/32 e la loro bella libreria compilando codice fino a 2Kbyte in ROM <a href="http://www.mikroe.com/eng/downloads/get/29/mikroc_pro_pic_2011_v460_setup.zip">(download)</a>. Consiglio per chi volesse un approccio soft al PIC di adottarlo usando la<a href="http://it.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=6153059&cm_vc=av_it"> probe PICKIT2 o 3 della Microchip</a> che trovate presso qualsiasi distributore elettronico a €37,00(circa)<br />Con questo investimento potete sperimentare una serie di progetti che sono veramente interessanti con il PIC e che pubblico qui sul mio Blog.<br /><br />Per reneder ancora più intrigante il codice stò elaborandone una versione per controllarlo da I2Bus ( non supportato da PIC12F628) in versione slave 10bit per comandare la posizione di strumenti analogici virtuali in Xplane.<br /><br />Il codice:<br /><br />/***************************************************************************<br />***** *****<br />***** 50Hz SINGLE SERVO TESTER USING 2 BUTTONS *****<br />***** 16F628A @ 4MHz INTOSC_NoClkout *****<br />***** Written By Warren Schroeder on 12.31.08 Mikrobasic 7.2 *****<br />***** Rewrite By mcmax on 10-05-2011 MikroC *****<br />***** software tested and run with *****<br />***** 1 microsecond position accuracy *****<br />***** Range of 1us to 19,999us *****<br />***** User can setup Min, Max, & Center Sweep Range as needed *****<br />***** *****<br />***** Features 2 Button Control For 3 Main Functions: *****<br />***** *****<br />***** Button1 = move to min position by user declared Step Value *****<br />***** Button2 = move to max position by user declared Step Value *****<br />***** Button1+Button2 = move to center position *****<br />***** *****<br />***** HOLDING a BUTTON WILL AUTO INCREMENT/DECREMENT Till MAX/MIN *****<br />***** *****<br />****************************************************************************/<br /><br />// macro<br /><br />typedef unsigned char uchar;<br />typedef unsigned int uint;<br /><br />#define delay30() Delay_ms(30)<br />#define SetTMR1(t) { CCPR1L = (uchar)(t & 0x00FF); \<br /> CCPR1H = (uchar)((t & 0xFF00) >> 8 ); }<br />#define GetTMR1() (int)CCPR1L + ((int)CCPR1H << 8 )<br />#define ClearTimer1() TMR1L=0; TMR1H=0;<br /><br />// definition<br /><br />#define _STEPVAL 5 // in microseconds Step ogni 30ms<br />#define _MAXPWM 20000 // 20ms (valori in millisecondi)<br />#define _MINPOS 600 // 0,6ms -90 -+<br />#define _CENTER 1500 // 1,5ms 0 -+----position servo centrale<br />#define _MAXPOS 2400 // 2,4ms +90 -+<br /><br />// global var<br /><br />unsigned int ServoPos;<br /><br />//***** I N T E R R U P T ************************************************<br /><br />void Interrupt( void )<br />{<br /> if ( CCP1IF_bit == 1) {<br /> if ( GP4_bit == 1 ){ // bit ccp1 bit 5 pin 3<br /> GP4_bit = 0; // turn servo off<br /> SetTMR1( _MAXPWM - ServoPos ); // off time to finish 20ms<br /> }<br /> else {<br /> GP4_bit = 1; // turn servo on<br /> SetTMR1( ServoPos); // on time in microseconds<br /> }<br /> ClearTimer1(); // rimette a 0 il timer1<br /> PIR1.CCP1IF = 0; // clear int flag<br /> }<br />}<br /><br />//-------------------------------------------------------------------------<br /><br />void CCP_Setup( void )<br />{<br /> T1CON = 0; // no prescale; off; 1us ticks<br /> ClearTimer1(); // clear timer1<br /><br /> ServoPos = _MINPOS; // posizione iniziale<br /><br /> CCP1CON = 0b00001010; // compare-match no ADC start or<br /> // reset timer1 when match<br /> SetTMR1( ServoPos ); // set intitial position<br /><br /> PIR1.CCP1IF = 0; // clear int flag<br /> PIE1.CCP1IE = 1; // enable int<br /> T1CON.TMR1ON = 1; // timer1 run<br /><br /> PEIE_bit = 1; // start periferical int<br /> GIE_bit = 1; // GIE, PEIE enabled<br />}<br /><br />/*********************************************************<br /> ***** *****<br /> ***** Buttons Inputs are Pulled Low on RA0 and RA1 *****<br /> ***** *****<br /> *********************************************************/<br /><br /><br />void KeyCtrl(void)<br />{<br /> char Temp;<br /><br /> if ((GPIO & 3) != 0x03 ) { // check for active buttons<br /><br /> Delay_Ms(30); // debounce delay<br /> Temp = GPIO & 0x03; // save button value<br /><br /> while ( Temp != 0) { // while a button is active do<br /><br /> if ( Temp == 3) { // both buttons active<br /> ServoPos = _CENTER; // goto center position<br /> }<br /> else {<br /> if ( Temp == 1) { // dec position by stepval<br /> ServoPos = ServoPos - _STEPVAL;<br /> if ( ServoPos < _MINPOS )<br /> ServoPos = _MINPOS;<br /> }<br /> else { // inc position by stepval<br /> ServoPos = ServoPos + _STEPVAL;<br /> if ( ServoPos > _MAXPOS)<br /> ServoPos = _MAXPOS;<br /> }<br /> }<br /> Delay_Ms(30); // button release delay<br /> Temp = GPIO & 3 ; // check again for release<br /> }<br /> } // if not released will inc or dec more<br />}<br /><br />/****** M A I N ***********/<br /><br />void main(void)<br />{<br /> INTCON = 0; // disable alla interrupt<br /><br /> OSCCON = 0b01100000; // work at 4Mhz of internal<br /> // clock without ext clk<br /> ANSEL = 0x00; // disable analog ad digital I/O<br /> CMCON0 = 0x07; // disable comparator<br /><br /> GPIO = 0x00; // init port setup<br /> TRISIO = 0x03; // bit 0 = 7 Key UP<br /> // bit 1 = 6 Key DW<br /> // pwm su pin 3 al servo motor<br /><br /> CCP_Setup(); // setup value application and timing<br /><br /> while(1) // main loop<br /> KeyCtrl(); // key controll<br /><br />}<br /><br />// end source<br /><br />Lo schema del prototipo<br /><br />Il PCB <br /><br />Le foto del prototipo<br /><br />Buon divertimento.Massimo Spatarohttp://www.blogger.com/profile/14813354023913974275noreply@blogger.comtag:blogger.com,1999:blog-9942905.post-68855442878935990122009-12-14T07:11:00.001-08:002009-12-14T10:46:31.837-08:00Piklab e pk2cmd integrare gli strumentiNella prededente post "<a href="http://mcmax.blogspot.com/2009/12/pk2cmd-pickit2-microchip-con-linux.html">pk2cmd PicKit2 microchip con Linux ubuntu</a>" abbiamo preso in considerazione il <a href="http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164120">PICkit 2 di microchip</a> per programmare una vasta serie di CHIP di MicroChip della serie PIC.<br /><br />Il tools di piklab integrato con <a href="http://sdcc.sourceforge.net/">sdcc </a>e con pk2cmd diventa un ottimo strumento per lo sviluppo rapido di applicazioni in linguaggio C e ASM per Pic. Il problema maggiormente sentito è che il rapido sviluppo di prodotti propietari mal si concila con lo sviluppo opensource affidato da un volontariato di sempre meno mani esperte che modificano e seguono il codice sorgente opensource di prodotti specifici. Pare che le case di produzioni abbiano anche poco interesse a pagare chi potrebbe dare piattaforme alternative a sviluppatori di microchip o silicon slide programmabili. Tra queste possiamo fare un lungo elenco di produttori di Chip programmabilie che vendono o sponsorizzano semi free tools di programazione ma solo per piattaforma Windows, senza tener conto che ampliando l'offerta di software anche con licenza proprietaria ma ben supportata e disponibile per il free of download farebbe crescere il mercato di vendita del loro prodotto (silicio) programmabile e dei tools di programmazione e/o debug.<br /><br />Bando alle polemiche e passiamo al problema della integrazione del comando descritto nel precedente post con l'interfaccia grafica di piklab.<br /><br />Nel sito di piklab non ho trovato indicazioni su come "custom comand" prendendo variabili dal programma (es: tipo processore, nome file, eccc....) pertanto vi faccio vedere come ho usato delle stringhe per la customizzazione del programma a mio vantaggio per il PICKit 2.<br /><br />Come vedete dalla seguente schermata le impostazioni interne al piklab per Pickit2 non vedono neppure il probe installato sulla USB ( problemi con ID e revision del SW del probe).<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmNrR5OeDWjEaJHWjP31qlcQgySChDuWEE1ncjfPr1HIuZ0G-5rcb6uKpSjkNTXKmpS3ZUVNmeRPw85c9X9N9JS8e2tclT61QHWUHrh5OJdmGchW96FmUCFQJGF6FGCev6jZ_Z/s1600-h/screen1.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 640px; height: 312px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmNrR5OeDWjEaJHWjP31qlcQgySChDuWEE1ncjfPr1HIuZ0G-5rcb6uKpSjkNTXKmpS3ZUVNmeRPw85c9X9N9JS8e2tclT61QHWUHrh5OJdmGchW96FmUCFQJGF6FGCev6jZ_Z/s320/screen1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5415160342605692914" /></a><br /><br /><br />Selezionate la voce "programmatore->configuratore" e selezionate il pannello come segue:<br /><br /><span style="font-style:italic;"><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-ZRlCDm6lmQBMC12uYbkGksbrpJ9kIPdEwhaXylRDmhB7RTQbk7iZIV54BTxWRJuvF6x7uacexVToxMpTQWMVe-BobxFAyhvUVJa1dOk03ZbN5IwrxJ_Y6bTuwEROidjqrQ0b/s1600-h/screen2.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 640px; height: 340px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-ZRlCDm6lmQBMC12uYbkGksbrpJ9kIPdEwhaXylRDmhB7RTQbk7iZIV54BTxWRJuvF6x7uacexVToxMpTQWMVe-BobxFAyhvUVJa1dOk03ZbN5IwrxJ_Y6bTuwEROidjqrQ0b/s320/screen2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5415160863759839266" /></a><br /></span><br /><br />Ora chiudete questo pannello e da comandi posizionate il file dati in modo che sia ricercabile dal pk2cmd. Piklab ignora il vostro path di percorso in .bashrc e qundi con questo comando risolviamo il problema.<br /><br /><span style="font-style:italic;">ln -s /usr/share/pk2/PK2DeviceFile.dat /usr/local/bin/PK2DeviceFile.dat</span> <br /><br />questo link fa credere a pk2cmd che il file sia corretamente posizionato quando richiamato da pikLab.<br /><br />ora provate a programmare il vostro Pic come qui sotto ottendo il success del comando.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUeaONWd2AdaylfkvIU7MZ0PmB-x0QvBIlh6GUflKBpgczTwB7_KlNg6BVgVUe9Z2XiroDld5EPX34Wmryh5PigRkaTTchfFIGm4rYRZH3j8phFziB7QTOWj9SKefvnBlynO5k/s1600-h/screen3.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 640px; height: 538px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUeaONWd2AdaylfkvIU7MZ0PmB-x0QvBIlh6GUflKBpgczTwB7_KlNg6BVgVUe9Z2XiroDld5EPX34Wmryh5PigRkaTTchfFIGm4rYRZH3j8phFziB7QTOWj9SKefvnBlynO5k/s320/screen3.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5415162089938966770" /></a><br /><br />Spero di essere stato utile alla sistemazione dell'itegrazione tra piklab e pk2cmd di microchip. La ricerca continua e spero di rendere autonomo il sistema di stringhe per allinearlo automaticamente al nome del file *.hex e al tipo di processore in conformita con il file di progetto aperto e i vari setup impostati.Massimo Spatarohttp://www.blogger.com/profile/14813354023913974275noreply@blogger.comtag:blogger.com,1999:blog-9942905.post-51511167253916837372009-12-03T23:42:00.000-08:002013-10-12T02:18:31.193-07:00pk2cmd PicKit2 microchip con linux<span style="font-weight: bold;">Dopo aver comperato il pickit2 ho verificato con mano che non sempre un probe di programmazione propietario sono supportati nativamente nell'ambiente Linux, tool come piklab eccezionali per semplicita' ed immediatezza sono penalizzati per funzionalita' quando interagiscono con prodotti proprietari, spingendo gli utenti all'autocostruzioni di programmatori seriali e paralleli.<br /><br />Ho trovato conveniente non investire tempo per autocostruire un programmatore e ho acquistato un <a href="http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164120">PICkit 2 di microchip</a> per 35,00 euro, convinto che comunque sarebbe stato facile implementarlo nel ciclo di programmazione e sviluppo prodotto.<br /><br />Naturalmente i driver ed il CD sono rigorosamante per Windows dell'uso con linux nessuna indicazione. Con un po' di ricerche sono arrivato al programma opensource da compilare per <a href="http://www.apple.com/">MAC osx</a> e <a href="http://www.debian.org">Linux</a> distribuito dalla MicroChip.<br /><br />Procedete scaricando questo file <a href="http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1960&fragment3_NextRow=31">pk2cmdv1.20LinuxMacSource.tar.gz (click qui)</a><br /><br />Scompattate nella directory che selezionate o direttamente sulla Scrivania (Desktop) il file qui sopra.<br /><br />Aprite un terminale seguendo il menu alto a sinistra <span style="font-style: italic;">Applicazioni-->Accessory-->Terminale<br /><br /></span>Andate nella cartella dei sorgenti per compilare,<br /></span><br />$ cd Scrivania/pk2cmdv1.20LinuxMacSource/<br />$ sudo su<br /># make linux<br /><br /><span style="font-weight: bold;"><span style="font-style: italic;">Se non compila probabilmente dovete installare il tool base per compilare da sorgenti.<br /><br /></span></span># apt-get install build-essential<br /><br /><span style="font-weight: bold; font-style: italic;">Poi ripetete il comando di </span><span style="font-style: italic;">make linux </span><span style="font-weight: bold;"><span style="font-style: italic;"><span style="font-style: italic;">che crea il comando pk2cmd.</span><br />Completate l'installazione come prescritto nel file </span></span><span>ReadmeForPK2CMDLinux2-6.txt</span><span style="font-weight: bold;"><span style="font-style: italic;"><br /><br /><span style="font-style: italic;">Con </span></span></span><span><span style="font-style: italic;"><span style="font-style: italic;"></span></span>nano</span><span style="font-weight: bold;"><span style="font-style: italic;"><span style="font-style: italic;"> editate il file </span></span></span><span><span style="font-style: italic;"><span style="font-style: italic;"></span></span>/home/vostronomeutente/.bashrc</span><span style="font-weight: bold;"><span style="font-style: italic;"><span style="font-style: italic;"> ed in fondo al file aggiungete queste due righe.<br /><br /></span></span></span><span>...<br />PATH=$PATH:/usr/share/pk2<br />export PATH<br /><br /><span style="font-weight: bold;">Salvate ed uscite completate l'installazione con il comando che installa il nuovo comando nella apposita cartella dei programmi di linux.<br /></span><br />#make install<br /></span><span style="font-weight: bold;"><span style="font-style: italic;"><br /></span></span><span style="font-weight: bold;">Ora siamo pronti per usare il nostro PICKit2<br /><br />Aprite un nuovo terminale </span><span style="font-weight: bold;"> ( <span style="font-style: italic;">cosi il sistema carica la definizione inserita in</span> </span><span style="font-style: italic;">.bashrc</span><span style="font-weight: bold;">),</span><span style="font-weight: bold;"> chiudete quello usato per compilare il package ora potete anche rimuovere la cartella dalla vostra scrivania mettendola nel cestino.</span><span style="font-weight: bold;"><span style="font-style: italic;"><br /><br /></span>Inserite nella interfaccia USB il vostro <a href="http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164120">PICKit2</a> e verificate se e' in linea con il comando </span><span>lsusb<span style="font-style: italic;"></span></span><span style="font-weight: bold;"><span style="font-style: italic;"><br /><br /></span></span><span>$ lsusb<br />...<br />Bus 007 Device 002: ID 04d8:0033 Microchip Technology, Inc.<br />...<br /><br /><span style="font-weight: bold;">Poi digitare per verificare se funziona la connessione del dispositivo vi a USB.</span><br /><br />$ pk2cmd ?V<br /><br /></span><span>Executable Version: 1.20.00<br />Device File Version: 1.55.00<br />OS Firmware Version: 2.32.00<br /><br /><span style="font-weight: bold;">Se avete il chip PIC 16F690 inserito nello <a href="http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164120">zoccolo del vostro demokit</a></span>:<br /><br /># pk2cmd -PPIC16F690 -I<br />Device ID = 1400<br />Revision = 0006<br />Device Name = PIC16F690<br /><br /><span style="font-weight: bold;">Come si puo' vedere il dispositivo funziona correttamente ed identifica il chip installato correttamente.</span><br /><br /><span style="font-weight: bold;">Passiamo ora alla gestione utile all'impiego del dispositivo con le nostre applicazioni.</span><br /><br /><span style="font-weight: bold;">Leggiamo il chip e mettiamo i dati in un file</span><br /><br />$ pk2cmd -PPIC16F690 -GF test.hex<br /></span><span style="font-weight: bold;"><span style="font-style: italic;"><br />-GF legge tuttoil contenuto RAM/EEPROM e zone di configurazione<br /><br />Cancelliamo il chip:<br /><br /></span></span><span>$ pk2cmd -PPIC16F690 -</span>E<br /><br /><span style="font-weight: bold;">Verifichiamo che il chip sia cancellato</span><br /><br /><span>$ pk2cmd -PPIC16F690 -C</span><br /><br /><span style="font-weight: bold;">Scriviamo il nostro programma nel chip</span><br /><br />$ pk2cmd -PPIC16F690 -F test.hex -M<br /><br /><span style="font-weight: bold;">Verifichiamo che il chip sia programmato</span><br /><br />$ pk2cmd -PPIC16F690 -F test.hex -Y<br /><br /><span style="font-weight: bold;">Ora attraverso il probe siamo pronti ad alimentare la nostra applicazione ( sempre che sia compatibile con il livello di tensione e assorbimento, se no staccate il probe evitando di danneggialo</span>)<br /><br />$ pk2cmd -PPIC16F690 -T<br /><br /><span style="font-weight: bold;">Ora potete spegnete l'alimentazione attraverso il probe.</span><br /><br />$ pk2cmd -PPIC16F690 -W<br /><br /><span style="font-weight: bold;">Bene ora abbiamo un probe di programmazione perfettamente funzionante e pronto per l'impiego. Visto il costo della probe e visto che e' semplice implementare il comando nel vostro sistema linux diciamo che il compromesso e' accettabile senza dover costruire un probe che rispetto a questo potrebbe essere limitato dal numero di dispositivi compatibili alla programmazione di <a href="http://www.microchip.com">MicroChip</a>. Provate digitando questo comando e leggete quanti sono i device che programma il probe.</span><br /><br><br />$ pk2cmd -?P<br /><br /><span style="font-weight: bold;">Sto vedendo se e' possibile una integrazione di questo command attraverso il sistema di </span><a href="http://piklab.sourceforge.net/changelog.php">piklab</a><span style="font-weight: bold;"> in maniera da non dover impiegare i comandi ed eseguire tutto attraverso l'interfaccia grafica di </span><a href="http://piklab.sourceforge.net/changelog.php">piklab</a><span style="font-weight: bold;">.</span><br /><br><br /><span style="font-weight: bold;">Buon Lavoro.</span>Massimo Spatarohttp://www.blogger.com/profile/14813354023913974275noreply@blogger.comtag:blogger.com,1999:blog-9942905.post-4709203379856127122009-03-12T03:15:00.000-07:002009-03-12T03:31:27.680-07:00Ubuntu Festival il computer che parlaDopo avere provato il nuovo Apple Shuffle ho pensato che il sistema Ubuntu aveva bisogno di una Voce simile per pilotare alcune applicazioni lisp sulla quale sto lavorando.<br /><br />Ecco i passi per installare Festival e farlo funzionare in italiano:<br /><br /><ul><li>Installa il pacchetto tramite <em>apt-get</em>:</li></ul> <code>apt-get install festival</code><br /><br /><code>apt-get install <span style="font-family: Georgia,serif;">festlex-ifd festvox-italp16k</span></code><br /><br />Cosi avrete una voce femminile simpatica<br /><ul><li>Viene installato nella cartella <code>/usr/share/festival</code> )</li><li>Crea nella cartella <em>home</em> personale il file <code>.festivalvarsrc</code> con il seguente contenuto:<br /><br /> <code>(set! main-path "/usr/share/festival")<br />(set! load-path (cons main-path load-path))</code> </li><li>Inserisci il seguente testo nel file <code>.festivalrc</code> (nella cartella <em>home</em> personale):<br /><br /> <code>(set! main-path "/usr/share/festival")<br />(set! libdir main-path)<br />(set! lexdir (path-append libdir "dicts"))<br />(set! voice_default 'voice_lp_diphone)</code> <br /></li></ul> A questo punto si può provare il funzionamento:<br /><br /><ul><li>Avvia festival:<br /><br /> <code>festival</code> </li><li>Facciamogli dire qualcosa:<br /><br /> <code>(SayText "Ciao sono il tuo computer Viki")</code></li><li>Oppure da linea comandi per i vostri script in shell mode<br /><br />$ festival -b italiandef.scm '<code>(SayText "Ciao sono il tuo computer Viki")</code>'<code></code></li></ul><code></code><br />Potete scaricare altre matrici vocali oltre all'italiano ( inglese, americano, francese, tedesco,ecc....)<br />Sentite una "calda" (!) voce femminile che si presenta? Ora il vostro Linux Ubuntu parla in italiano ;)Massimo Spatarohttp://www.blogger.com/profile/14813354023913974275noreply@blogger.comtag:blogger.com,1999:blog-9942905.post-7608601640945411542009-01-14T06:42:00.000-08:002009-01-14T06:56:42.514-08:00<h2>Virtual Lisp Machine on Linux</h2>Emulator on 64Bit kernel Linux of Aplha Core<br /><br /><table id="toc" class="toc" summary="Contents"><tbody><tr><td><div id="toctitle"><h2>Contents</h2> <span class="toctoggle">[<a href="javascript:toggleToc()" class="internal" id="togglelink">hide</a>]</span></div> <ul><li class="toclevel-1"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#Running_VLM_on_Linux"><span class="tocnumber">1</span> <span class="toctext">Running VLM on Linux</span></a> <ul><li class="toclevel-2"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#What_is_the_VLM.3F"><span class="tocnumber">1.1</span> <span class="toctext">What is the VLM?</span></a></li><li class="toclevel-2"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#Using_the_snap4_Port"><span class="tocnumber">1.2</span> <span class="toctext">Using the snap4 Port</span></a></li><li class="toclevel-2"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#inetd"><span class="tocnumber">1.3</span> <span class="toctext">inetd</span></a></li><li class="toclevel-2"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#nfs-user-server"><span class="tocnumber">1.4</span> <span class="toctext">nfs-user-server</span></a></li><li class="toclevel-2"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#File_Server_authentication_using_the_NIS"><span class="tocnumber">1.5</span> <span class="toctext">File Server authentication using the NIS</span></a></li><li class="toclevel-2"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#Starting_Genera_and_defining_your_site"><span class="tocnumber">1.6</span> <span class="toctext">Starting Genera and defining your site</span></a></li><li class="toclevel-2"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#Networking_the_VLM"><span class="tocnumber">1.7</span> <span class="toctext">Networking the VLM</span></a></li><li class="toclevel-2"><a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux&diff=42904&oldid=42903#Getting_a_Meta_Key"><span class="tocnumber">1.8</span> <span class="toctext">Getting a Meta Key</span></a></li></ul> </li></ul> </td></tr></tbody></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script> <a name="Running_VLM_on_Linux"></a><h1> <span class="mw-headline"> Running VLM on Linux </span></h1> <p>This file gives some additional hints on running the Symbolics Virtual Lisp Machine (VLM) port to Linux/x86_64 by Brad Parker. I am running the VLM on a Ubuntu 6.06.1 host, so whatever I describe here may not work with other distributions. My background is FreeBSD, so some things I describe may be obvious to those with a Linux background. The configuration I describe in this file does not try to provide "security", so by following it, you will potentially expose all files on your Linux host as well as all passwords you may enter into this configuration to the Internet, and beyond. </p> <a name="What_is_the_VLM.3F"></a><h2> <span class="mw-headline"> What is the VLM? </span></h2> <p>The VLM is a development by Symbolics that, in a way, represents the last Lisp machine built before Symbolics went bankrupt. It was originally written for the DEC Alpha processor, which was the first 64 Bit CPU that was commercially available. A software implementation of the Lisp machine required a 64 Bit CPU to attain acceptable performance. The VLM implements the full Lisp machine architecture, so it is largely software compatible to the "real" Symbolics Lisp machines (36xx, Ivory). </p><p>Brad Parker wrote an implementation of the VLM for Linux. It is based on the Symbolics software, and there is some uncertainty about its legal status as well as the legal status of the rest of Symbolics intellectual property. This seems to mean that redistribution of the software or using it in a commercial context is not possible at the moment. </p><p>The VLM program is an emulator, it implements the environment for the Lisp machine operating system, Genera, that looks like real hardware from the Lisp side. It supports a virtual ethernet interface and a console. The screen is implemented using the X Window System, so you need to have X11 running on your host. </p><p>Presently, the ethernet interface is hardwired to use the address 10.0.0.1 for the Linux host and 10.0.0.2 for the VLM. This cannot be changed. See the section on "Networking the VLM" in this file for some information on how to work with this. </p> <a name="Using_the_snap4_Port"></a><h2> <span class="mw-headline"> Using the snap4 Port </span></h2> <p>First of all, you need to get the VLM for Linux tar ball from <a href="http://www.unlambda.com/download/genera/snap4.tar.gz" class="external free" title="http://www.unlambda.com/download/genera/snap4.tar.gz" rel="nofollow">http://www.unlambda.com/download/genera/snap4.tar.gz</a> - There may be a newer version, so please check out the base directory and read this file with extra care if you are using a newer version. Unpack the snap4 distribution on your Ubuntu host system. Make sure that you have read the README file in the distribution, at least briefly. This file supplies additional information you'll need. </p><p>You also want the OpenGenera 2.0 distribution tarball which includes the system sources as well as additional software packages and example files. There is no official distribution site for this tar ball, so you will have to ask around for this. If you have it, unpack it in a directory that you wish to be accessed by the VLM, for example /vlm. </p><p>My starting point is a plain Ubuntu installation from the 6.06.1 boot CD without any special options. A few packages need to be added in order to make the Linux host system provide the neccessary service to the VLM. Some of these services are found in auxilary package source which need to be enabled in /etc/apt/sources.list (I uncommented all commented-out package sources). </p> <pre>$ sudo apt-get update<br /></pre> <p>needs to be run after the sources have been enabled in order to refresh the local cache of package names. </p><p>The following packages are required in addition to the base system: </p> <pre>$ sudo apt-get install inetd nfs-common nfs-user-server<br /></pre> <p>If "inetd" doesn't work for you, try "netkit-inetd". If "nfs-user-server" doesn't work for you, you probably didn't uncomment the package sources in /etc/apt/sources.list as described above. </p> <a name="inetd"></a><h2> <span class="mw-headline"> inetd </span></h2> <p>The Internet superserver is used to provide the VLM with the system date and time during startup. After installation, the following entries in /etc/inetd.conf need to be added or uncommented: </p> <pre>$ cat /etc/inetd.conf<br />daytime stream tcp nowait root internal<br />daytime dgram udp wait root internal<br />time stream tcp nowait root internal<br />time dgram udp wait root internal<br /></pre> <p>After the file has been updated, restart inetd with </p> <pre>$ sudo /etc/init.d/inetd restart<br /></pre> <a name="nfs-user-server"></a><h2> <span class="mw-headline"> nfs-user-server </span></h2> <p>The NFS file server is used to give the VLM access to a file system. In theory, the kernel mode NFS server should give better performance, but I had difficulties getting it to run. After installation, /etc/exports needs to be updated in order to export the host's file system to the VLM by adding a line like: </p> <pre>$ cat /etc/exports<br />/ 10.0.0.2(rw,no_root_squash)<br /></pre> <p>Depending on NFS server flavour, you may want to add also the following options after the no_root_squash option to squelch some warnings </p> <pre>sync,subtree_check<br /></pre> <p>After this has been done, restart the NFS server using </p> <pre>$ sudo /etc/init.d/nfs-user-server restart<br /></pre> <p>Now verify that your file system is properly exported: </p> <pre>$ showmount -e localhost<br /></pre> <p>Note that the VLM now has full access to the hosts' file system and can overwrite or delete any file. You may restrict access by exporting only part file system, but I have not tried this. Also note that this example exports the file system to 10.0.0.2, which is the compiled-in address of the VLM. Other systems in the network have no access to the hosts' file system. </p><p>If you access files from the VLM through NFS using "anonymous" access, the uid 4294967294 and gid 4294967294 will be used. These ids are presumably meant to mean "nobody". Add entries to /etc/passwd and /etc/group for this uid and gid in order to have something better than the numeric uid be displayed when listing files on the host system. </p> <pre>$ grep lispm /etc/passwd /etc/group<br />/etc/passwd:lispm:x:4294967294:4294967294::/tmp:/bin/false<br />/etc/group:lispm:x:4294967294:<br /></pre> <p>You now have a basic setup that will allow you to start Genera. Skip to "Starting Genera and defining your site" if you are impatient. </p> <a name="File_Server_authentication_using_the_NIS"></a><h2> <span class="mw-headline"> File Server authentication using the NIS </span></h2> <p>If you want to set up log ins from the VLM to the NFS server on the host system, the VLM needs to get access to the mapping from user ids and group ids to user names and vice versa. When Genera was written, the NIS protocol was commonly used to provide this service within local networks. NIS basically exports the authentication files in the traditional unix format to a local area network. </p><p>To run NIS, you need the nis package: </p> <pre>$ sudo apt-get install nis<br /></pre> <p>You need to decide what your NIS domain name will be. This domain name does not need to correspond to your DNS domain name. My NIS domain name is the same as my Genera site name ("pharmacy"), but anything else could be used instead. The NIS domain name must be put into the file /etc/defaultdomain: </p> <pre>$ cat /etc/defaultdomain<br />pharmacy<br /></pre> <p>You need to set up your system as NIS master in the file /etc/default/nis: </p> <pre>$ grep NISSERVER /etc/default/nis<br />NISSERVER=master<br /></pre> <p>Your password file needs to use "unix crypt" style passwords instead of the now-common md5 passwords. On Ubuntu with the default installation I use, this is configured in the file /etc/pam.d/common-password by commenting out the string "md5": </p> <pre>$ grep md5 /etc/pam.d/common-password<br />password required pam_unix.so nullok obscure min=4 max=8 # md5<br /></pre> <p>Note that you will now have to re-set all passwords using the "passwd" command so that they appear in the correct format. </p><p>The VLM does not support shadow passwords, so you need to convert your password database: </p> <pre>$ sudo pwunconv<br />$ sudo grpunconv<br /></pre> <p>Once all this is done, you have to initialize your NIS database: </p> <pre>$ cd /var/yp<br />$ sudo make<br /></pre> <p>This should leave you with a NIS server that can be used for authentication from the Lisp machine. </p> <a name="Starting_Genera_and_defining_your_site"></a><h2> <span class="mw-headline"> Starting Genera and defining your site </span></h2> <p>Once you have set up a suitable host environment, you need to configure the .VLM file in the snap4/ directory. (Note: Make sure you are using the .VLM file and not the dot.VLM file!) As distributed, it contains two wrong lines: </p> <pre>genera.world: ../symbolics/MIT.vlod<br />genera.debugger: ../symbolics/VLM_debugger<br /></pre> <p>These should read </p> <pre>genera.world: MIT.vlod<br />genera.debugger: VLM_debugger<br /></pre> <p>Fix the two lines and save the file. Now you are ready to start the VLM by changing your working directory to the snap4/ directory and type: </p> <pre>$ sudo ./genera<br /></pre> <p>The VLM should start and present you with a welcome screen that asks you to log in. You will then have to define your site, please see the quickstart.text file in the OpenGenera distribution directory for information how to do that. </p><p>Once you have defined your site, save your world: </p> <pre>Command: Reset Network<br />Command: Save World <your-host>:/tmp/my-genera.vlod<br /></your-host></pre> <p>Replace <your-host> by the name of your Linux host, as defined in the Define Site process. The path you specify needs to be writable from the VLM through NFS. If it is not writeable, the VLM will crash and you'll loose the site definition. </your-host></p> <a name="Networking_the_VLM"></a><h2> <span class="mw-headline"> Networking the VLM </span></h2> <p>As mentioned, the VLM has a fixed network configuration with a private IP address. In order to be able to access hosts in the Internet, your Linux host needs to do network address translation. I used the "firestarter" utility to get a basic configuration running, but this has the drawback that the firewall has to be manually started after the VLM had come up. firestarter creates interface-dependent firewall rules and the tun0 interface, which is used by the VLM, exists only while the VLM runs. I am sure that a better setup can be created by someone who knows more about Linux firewalls, and the best way would be to use a bridge interface in the VLM so that the Linux network stack would be fully circumvented. Maybe in the next release. </p> <a name="Getting_a_Meta_Key"></a><h2> <span class="mw-headline"> Getting a Meta Key </span></h2> <p>Try </p> <pre>$ xmodmap -e "keysym Alt_L = Meta_L Alt_L"<br />$ xmodmap -e "add mod1 = Meta_L"<br /></pre> <p>if your left Alt key does not act as a Meta key. </p><p>Ps. Setup Your Clock harware to time before 31/12/2000 ( this Image of system have bug of Millenium not set )<br /></p><p>(thanks to ecraven)<br /></p><p><a href="http://thepiratebay.org/user/bugmenot34">torrent for test image</a><br /></p><div class="printfooter"> Retrieved from "<a href="http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux">http://labs.aezenix.com/lispm/index.php?title=VLM_On_Linux</a>"</div> <!-- end content --> <div id="column-one"><div id="p-search" class="portlet"><div id="searchBody" class="pBody"><form action="/lispm/index.php?title=Special:Search" id="searchform"><div><input name="fulltext" class="searchButton" id="mw-searchButton" value="Search" title="Search the pages for this text" type="submit"></div></form></div></div></div>Massimo Spatarohttp://www.blogger.com/profile/14813354023913974275noreply@blogger.com