{ ********************************************************************** ** Programma: S1DEB6.PAS Versione: 1.1 -29 Gennaio 1999 ** ** Ditta: GRIFO(r) Via Dell'Artigiano 8/6 ** ** 40016 San Giorgio di Piano (BO) ** ** Tel. 051-892052 FAX 051-893661 ** ** Realizzato da: Tassinari Enea ** ********************************************************************** Il programma e' in grado di far scorrere i led del PORT A e PORT C in una direzione in modo sequenziale. Per il funzionamento del seguente programma e' necessario un compilatore pascal (parte software), una scheda DEB01 e una scheda GPC-15R opportunamente collegate (parte hrdware). } program S1DEB6; {$C-} { disabilita il Ctrl+C } const CNT=$17; { Registro di controllo e comando del PPI 82C55 } PDA=$14; { Registro dati del port A } PDC=$16; { Registro dati del port C } RIT=100; { Ritardo di 100 ms } var STATO:byte; TASTO:char; VAL:integer; VAL1:integer; procedure INIZIALIZZAZIONE; { Inizializzazione del registro di controllo dell' 82C55 } begin port[CNT]:=130; end; procedure SCRITTURA (STATO:byte; INDIRIZZO:byte); { Scrittura sul Port A e Port C tramite la variabile INDIRIZZO } begin port[INDIRIZZO]:=STATO; end; begin {programma principale } clrscr; INIZIALIZZAZIONE; gotoxy(10,3); writeln('VISUALIZZAZIONE DELLO SCORRIMENTO DEI LED SUI PORT A-C IN CORSO'); gotoxy(25,4); write('Premere un tasto per uscire'); repeat begin SCRITTURA(255,PDA); SCRITTURA(255,PDC); VAL:=1; repeat begin SCRITTURA(255-VAL,PDA); delay(RIT); VAL:=VAL shl 1; { Compie la stessa operazione della moltiplicazione per 2 in modo piu' veloce. } end; until (VAL=256) or keypressed; if not keypressed then begin SCRITTURA(255,PDA); VAL1:=1; repeat begin SCRITTURA(255-VAL1,PDC); delay(RIT); VAL1:=VAL1 shl 1; end; until (VAL1=256) or keypressed; SCRITTURA(255,PDC); delay(RIT); end; end; until keypressed; SCRITTURA(255,PDA); SCRITTURA(255,PDC); { Permette di mantenere, all'uscita del programma, tutti i led del spenti } read(kbd,TASTO); end.