beautypg.com

Measurement Computing Micro 488/EX rev.2.1 User Manual

Page 62

background image

Section 4

General Programming

4.20

680 OPEN F$ FOR INPUT AS #2
690 CLOSE #2
700 PRINT: PRINT CHR$(7);"Replace existing ";F$;" File?
(Y/N) ";
710 K$ = INKEY$ : PRINT K$;
720 IF K$ = "y" OR K$ = "Y" THEN GOTO 750
730 IF K$ = "n" OR K$ = "N" THEN GOTO 610
740 GOTO 710 ' try agin for valid key press
750 ' open the disk file
760 ON ERROR GOTO 0 ' turn error off
770 OPEN F$ FOR OUTPUT AS #2
780 RETURN
790 ' file does not exist error
800 RESUME 750

The program can be modified to utilize CTS/RTS hardware serial

handshaking by including and substituting the follow program lines.
Hardware handshake is implemented by writing directly to the COM port
hardware. The hardware address shown below is for the Modem Control
Register of the 8250 UART in COM1. For COM2, refer to your hardware
manual.

Add the following program lines…

175 MCR = &H03FE ' Modem control register of 8250 UART
176 ON = INP(MCR) OR &H02
177 OFF = IMP(MCR) AND &HFD

and substitute the following program lines…

520 OUT MCR,OFF ' Un-Assert RTS
550 OUT MCR,ON ' Assert RTS

The following describes the functionality of the Read Log program on a

line by line basis.

Line 170

Opens the COM1 port on the PC for serial
communications with the Micro488/EX.

Line 180

Sends the ID command to the Micro488/EX to reset it to
known power-on conditions. It utilizes the time delay
provided by line 190; get the output file name.

Line 190

GOSUB

s to a subroutine to get the output file name and

open it.

Line 200

Provides a method to include a user comment in the log