'****************************************************************************** ' QuickBasic Language Sample #2 : SAMPLE2.BAS ' ' This program will display the status of each bit in the status register and ' displays the temperature inside your computer. ' ' Last Modified On: January 30, 1995 ' '****************************************************************************** DECLARE FUNCTION AskForBaseAddress (OldOne AS INTEGER) BASEADDR = AskForBaseAddress(&H350) CLS PRINT "Basic Sample #2: Reading Control Register and Temperature" PRINT "This program demonstrates how to read the Control Register and" PRINT "Temperature at BASE+4 and BASE+5, respectively." PRINT "Please note that some features require that options be installed" PRINT "A keystroke will stop the program." PRINT PRINT "Press any key to start." WHILE INKEY$ = "" ' grab keystroke WEND CLS PRINT " Status Control Register Values " PRINT " " PRINT " Bit Number Value Description " PRINT " 0 1 When 0, CTR1 has timed out " PRINT " 1 1 When 0, temperature is too high OPTION 2" PRINT " 2 1 Isolated digital input #0 OPTION 4" PRINT " 3 1 Isolated digital input #1 OPTION 4" PRINT " 4 0 When 0, speed of fan is correct OPTION 4" PRINT " 5 1 When 0, the Voltage is too high OPTION 1" PRINT " 6 1 When 0, the Voltage is too low OPTION 1" PRINT " 7 1 When 0, an INT has occured " PRINT " " PRINT " Temperature inside computer is 000.0øF. OPTION 3 (=187 if not installed)" PRINT " " PRINT " Press any key to exit this program..." WHILE INKEY$ = "" FOR CurBit = 0 TO 7 LOCATE 4 + CurBit, 19 IF ((((INP(BASEADDR + 4)) AND (1 * (2 ^ CurBit))) = (1 * (2 ^ CurBit))) = -1) THEN PRINT 1 ELSE PRINT 0 END IF NEXT CurBit LOCATE 13, 34 PRINT USING "###.#"; (INP(BASEADDR + 5) * (11/15)) + 7 WEND PRINT FUNCTION AskForBaseAddress (OldOne AS INTEGER) Msg$ = "" NewOne% = 0: Success = 0: Dummy% = 0 AddrInputPosX = 0: AddrInputPosY = 0 PRINT "Please enter the Base Address (0000-FFFF) for your card (in hex)" PRINT "or press ENTER for "; HEX$(OldOne%); "." PRINT ">"; AddrInputPosX = POS(0): AddrInputPosY = CSRLIN WHILE Success = 0 LOCATE AddrInputPosY, AddrInputPosX PRINT " " LOCATE AddrInputPosY, AddrInputPosX LINE INPUT Msg$ NewOne% = VAL("&H0" + LEFT$(Msg$, 4)) Success = 1 Dummy% = NewOne% IF (Msg$ = "") THEN LOCATE AddrInputPosY, AddrInputPosX PRINT HEX$(OldOne%) Success = 1 Dummy% = OldOne% END IF WEND AskForBaseAddress = Dummy% END FUNCTION