{ ****************************************************************************** Pascal Language Sample #2 : SAMPLE2.PAS This program will display the status of each bit in the status register and displays the temperature inside your computer. ****************************************************************************** } Uses Crt; Const BASE = $350; Var Ch : Char; CurBit : Byte; Begin clrscr; writeln('Pascal Sample #2: Reading Control Register and Temperature'); writeln('This program demonstrates how to read the Control Register and'); writeln('Temperature at BASE+4 and BASE+5, respectively.'); writeln('Please note that some functions require options to be installed.'); writeln('A keystroke will stop the program.'); writeln; writeln('Press any key to start.'); ch := readkey; { Grab keystroke. } clrscr; writeln(' Status Control Register Values '); writeln(' '); writeln(' Bit Number Value Description '); writeln(' 0 1 When 0, CTR1 has timed out '); writeln(' 1 1 When 0, temperature is too high OPTION 2'); writeln(' 2 1 Isolated digital input #0 OPTION 4'); writeln(' 3 1 Isolated digital input #1 OPTION 4'); writeln(' 4 0 When 0, Speed of fan is correct OPTION 4'); writeln(' 5 1 When 0, the Voltage is too high OPTION 1'); writeln(' 6 1 When 0, the Voltage is too low OPTION 1'); writeln(' 7 1 When 0, an INT has occured '); writeln(''); writeln(' Temperature inside computer is 000.0øF. OPTION 3 (=187.0 if not installed)'); writeln(' Press any key to exit this program... '); Repeat For CurBit := 0 To 7 Do Begin GotoXY(19, 4 + CurBit); { Go to correct line } Write(Ord((Port[BASE+4] AND (1 SHL CurBit)) = (1 SHL CurBit))); { check bit } End; GotoXY(34, 13); Write((((Port[BASE+5] * (11/15))) + 7):5:1); { Temperature is simply ((BASE+5) * 11/15) + 7} Until KeyPressed; writeln; End.