DECLARE FUNCTION AskForBaseAddress% (OldOne AS INTEGER) DECLARE FUNCTION Deci% (DS AS STRING) DECLARE SUB ExitProgram () DIM SHARED ErrorCode ' $INCLUDE: 'SSH0XDRV.INC' BaseAddress% = &H350 DIM Buf(1 TO 8) AS INTEGER Choice = 1 CLS BaseAddress = AskForBaseAddress(BaseAddress%) ' Prompt for base addr ErrorCode = SetBaseAddress(BaseAddress%) ' Tell driver base addr CLS PRINT "Microsoft QuickBasic Language Sample for SSH-0x. Version 1.06" PRINT PRINT PRINT "This sample will show how to use the driver in mode 0." PRINT "Specs for mode 0:" PRINT " Total Software control." PRINT " OP3 (PIN 10) controls HOLD." PRINT PRINT "A/D card setup:" PRINT " Card is at base address "; HEX$(BaseAddress); "." IF (ADNAME = AD128CARD) THEN PRINT " Remove jumpers D0-D3 on your AD12-8 card." PRINT PRINT "SSH-0x card setup:" PRINT " Please place the A/D CH SEL jumper at 0." PRINT " Switches A, B, and C of MODE CONTROL should all be OFF." IF ((ADNAME = AD128CARD) OR (ADNAME = AD1216CARD)) THEN PRINT " MASTER, 2, and 3 should be ON. Switches 1 and 4 should be OFF. " ELSE PRINT " MASTER, 1, and 4 should be ON. Switches 2 and 3 should be OFF. " END IF PRINT PRINT "Press any key to continue... " WHILE INKEY$ = "" WEND CLS PRINT "The card will now be placed in Hold mode by setting OP3 high." PRINT "Eight data points will be taken from the SSH-0x card, one from" PRINT "each channel. (If you are using an SSH-04 card, channels 4-7 should" PRINT "be ignored). The card will then be placed back into Sample" PRINT "mode and the values will be displayed. Press a key to proceed..." WHILE INKEY$ = "" WEND CLS WHILE Choice ' Call driver ' Parameter list ' 1 : First channel is channel number 0 ' 2 : Last channel is channel number 7 ' 3 : Repeat for only 1 scan ' 4 : Trigger source is by software ' 5 : No initial delay ' 6 : Acquistion not controlled by counters, so period is 0 ' 7 : IRQ not necessary, set to 0 ' 8 : Use Mode 0 ' 9 : Data buffer is buf ErrorCode = PerformSSHDataAcquisition(0, 7, 1, 1, 0, 0, 0, 0, VARSEG(Buf(1)), VARPTR(Buf(1))) IF (ErrorCode <> 0) THEN CALL ExitProgram CLS PRINT PRINT " Channel Volts " PRINT i = 0 FOR i = 1 TO 8 ' display data for eight channels PRINT " "; i; " "; PRINT USING "+#.###"; (Buf(i) * (10! / 4096!)) - 5! ' display in volts NEXT i PRINT PRINT PRINT "Press the space bar to repeat or any other key to exit..." WhatKey$ = "" WHILE WhatKey$ = "" WhatKey$ = INKEY$ WEND IF WhatKey$ = " " THEN Choice = 1 ELSE Choice = 0 ' repeat as long as ' user presses space WEND PRINT "Exiting Sample 0 Program..." 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 FUNCTION Deci% (DS AS STRING) Deci% = VAL("&H" + DS) END FUNCTION SUB ExitProgram PRINT "ErrorCode: "; ErrorCode END END SUB