Serial Port Command Echo; Serial Port Command Completion Indicator; Reading The Status Of The Lambda Dg-4/5; Listing 4-2. Command Echo Check Routine - Sutter Instrument Lambda DG-4 Operation Manual

Ultra-high-speed wavelength switching illumination system
Table of Contents

Advertisement

you have used a BASIC language open statement to establish serial communications, the
subsequent 8 bit command values may be sent using a BASIC PRINT # command such as:
PRINT #1, CHR$(DATANUM);
... where #1 is the file number used in the open statement, and DATANUM is the value of
the command to be sent. Note that the CHR$ function allows the actual number to be sent
rather than the ASCII numbers of the characters that represent the number. Sending ";"
disables the automatic addition of characters such as a linefeed or a space.
For most commands sent over the serial interface, a simple form of protocol is provided that
can be used to determine the success or failure of commands and the speed at which
commands are transmitted.
In order to read the responses using BASIC, you can use a statement such as:
IF LOC(1) > 0 THEN SerialInput$ = INPUT$(1, #1)
LOC(1) > 0 indicates that bytes are waiting in the received data buffer. INPUT$(1, #1) reads
one byte from the buffer, which is stored as SerialInput$.

4.2.3 Serial Port Command Echo

In the serial mode, the Lambda DG-4/5 controller responds to each command by echoing the
command back to the host computer. This indicates that the command was received and will
be executed promptly. If the sent command is the same as the last command received, it will
not be echoed and the controller will take no action. The following subroutine could be used
to hold the computer in a loop until the command is properly echoed.
COMMANDCHECK: IF LOC(1) > 0 THEN SerialInput$ = INPUT$(1, #1)
NOTE: The only serial command not echoed back by the Lambda DG-4/5 is the "Go On Line"
(238 decimal, EE hexadecimal) command.

4.2.4 Serial Port Command Completion Indicator

In the case of filter movement commands (0 through 32), the Lambda DG-4/5 will send back
to the host computer a byte with the value of 13 decimal (0D hexadecimal), which is an ASCII
CR (carriage return). Nearly the same subroutine can be used to hold the computer in a loop
until the carriage return (13) is received.
BUSYCHECK:

4.2.5 Reading the Status of the Lambda DG-4/5

The Lambda DG-4/5 controller signals that it has completed commands received through its
serial port by sending a carriage return back. The following is an example of a QuickBasic

Listing 4-2. Command echo check routine.

IF DATANUM = ASC(SerialInput$) THEN RETURN
GOTO COMMANDCHECK

Listing 4-3. Command-completion check routine.

IF LOC(1) > 0 THEN SerialInput$ = INPUT$(1, #1)
IF
ASC(SerialInput$)=13 THEN RETURN
GOTO BUSYCHECK
LAMBDA DG-4 & DG-5 OPERATION MANUAL – REV. 3.05C (20150414)
47

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Lambda DG-4 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Lambda dg-5

Table of Contents