beautypg.com

Read macro buffers program – Measurement Computing Micro 488/EX rev.2.1 User Manual

Page 64

background image

Section 4

General Programming

4.22

Read Macro Buffers Program

100 '
110 ' Program to read and record all of the Micro488/EX's
120 ' macro buffers and save them to a disk file.
130 ' Serial control is set to Xon/Xoff
140 ' IOtech, Inc.
150 '
160 ' Open the serial port for communications
170 OPEN "com1:9600,n,8,2" AS 1
180 PRINT#1,"@@"; ' reset the Micro488/EX
190 ' get file name
200 GOSUB 580 ' get the output file name
210 PRINT:PRINT "Enter File Comment => ";: LINE INPUT C$
220 ' loop until serial input buffer is empty
230 WHILE NOT EOF(1) : A$ = INPUT$(1,1) : WEND
240 '
250 ' set up file header
260 '
270 WHILE NOT EOF(1) : A$ = INPUT$(1,1) : WEND ' empty
serial input
280 PRINT#2,"*"
290 PRINT#2,"* Macro Backup "
300 PRINT#1,"Hello"
310 LINE INPUT #1,H$
320 PRINT#2,"* ";H$
330 PRINT#1,"Day Date Time"
340 LINE INPUT#1, D$
350 PRINT#2,"* ";D$
360 PRINT#2,"* ";C$
370 PRINT#2,"*": PRINT#2,""
380 '
390 ' get macro programs
400 '
410 PRINT:PRINT"Reading Macros"
420 PRINT#1,"Error Number"
430 INPUT #1,A$ ' get initial error number
440 FOR MACRO = 0 TO 99
450 PRINT "."; ' for visual indication
460 PRINT#1,"read ";MACRO
470 LINE INPUT #1,A$
480 IF A$ = "6" THEN GOTO 550 ' No Macro error number
490 PRINT#2," ": PRINT#2,"* Macro";MACRO ' comment line
495 PRINT#2,"Macro";MACRO : PRINT#2,A$
500 WHILE NOT EOF(1)
510 LINE INPUT #1,A$
520 IF A$ = "0" THEN GOTO 550 ' got the completed macro
530 PRINT#2,A$
540 WEND
550 NEXT MACRO