beautypg.com

C - sample initialization program, C – sample initialiazation program, Appendix c sample initialization program – Measurement Computing Micro488/p User Manual

Page 43

background image

Appendix C, Sample Initialization Program

09-27-02

C-1

Appendix C Sample Initialization Program

'Sample Micro488/p initialization program
'Copyright 1992, IOtech Inc.
'
'This program demonstrates how to initialize the Micro488/p IEEE
'controller using Quick Basic. This program will initialize the
'Micro488/P, and establish IEEE communications.

CLS
CLOSE

'Close all files, this turns off DTR and DSR.

com$ = "COM1:19200,N,8,1,BIN"
IeeeOut = FREEFILE
IeeeIn = FREEFILE

OPEN com$ FOR RANDOM AS #IeeeOut

'Open the serial port on COM 1

t = TIMER
DO WHILE t + .1 > TIMER

'Wait for .1 Seconds

LOOP

FOR i = 1 TO 5

'Send 5 carriage returns, with a .1

'second delay seperation.

PRINT #IeeeOut, CHR$(13);
t = TIMER
DO WHILE t + .1 > TIMER
LOOP

NEXT i

PRINT #IeeeOut, "I"

'Send Init command

PRINT #IeeeOut, "EC;0"

'Turn off serial echo

PRINT #IeeeOut, "H;1"

'Turn on hardware handshake

PRINT #IeeeOut, "X;0"

'Turn off XON/XOFF handshake

PRINT #IeeeOut, "TC;2"

'Set serial terminator to CR

PRINT #IeeeOut, "TB;4"

'Set IEEE bus terminator to CR

LF

t = TIMER
DO WHILE t + .5 > TIMER

'Wait .5 seconds

LOOP

a$ = INPUT$(LOC(1), #IeeeIn)

'Clear the serial input buffer.