{ ********************************************************************** ** Program: S1DEB5.PAS Version: 1.1 - 28 Jenuary 1999 ** ** Firm: GRIFO(r) Via Dell'Artigiano 8/6 ** ** 40016 San Giorgio di Piano (BO) ** ** Tel. 051-892052 FAX 051-893661 ** ** Developed by: Tassinari Enea ** ********************************************************************** This program allows to display on A port, the C port status if switch 1 of the dip switch is on "ON" position and his opposit, if switch 1 is on "OFF" position. In order to make an easier visualization of the status lines, it is necessary to get a 20 pins flat cable for connecting GPC(r)15R CN9 connector to TIO 16 CN1 connector, or DEB-01 CN15 connector. } program S1DEB5; {$C-} { Ctrl+C = OFF } const CNT=$17; { control and command register of the PPI 82C55 } PDA=$14; { data register of the A port } PDB=$15; { data register of the B port (dip switch) } PDC=$16; { data register of the C port } var STATO:byte; SWC:integer; VIS:integer; TASTO:char; RIS:integer; procedure INIZIALIZZAZIONE; { Initialization of the control register of the 82C55 } begin port[CNT]:=139; end; function LETTURA (INDIRIZZO:integer):byte; { read the dip switch and C Port status } begin LETTURA:=port[INDIRIZZO]; end; procedure SCRITTURA (STATO:byte); { write on A port, the C port status } begin port[PDA]:=STATO; end; begin {program main } clrscr; INIZIALIZZAZIONE; gotoxy(10,3); writeln('VISUALIZATION ON A PORT, THE C PORT STATUS IN PROGRESS'); gotoxy(15,4); writeln('IF SWITCH 1 OF THE DIP SWITCH=OFF THE C PORT'); gotoxy(18,5); writeln('IS IN NEGATIVE LOGIC CONFIGURATION'); gotoxy(25,6); write('Press any key for exit'); repeat begin SWC:=LETTURA(PDB); VIS:=LETTURA(PDC); RIS:=SWC and 1; { Make logic AND for mask the switch 2,3,4,5,6,7,8 } if RIS=0 then SCRITTURA(VIS) else SCRITTURA(255-VIS) end; until keypressed; SCRITTURA(255); { Led OFF in the end time } read(kbd,TASTO); end.