Terminal emulation program for ibm® pc, Serial connections, Terminal descriptions – Red Lion C48T User Manual

Page 33

Advertising
background image

Terminal Emulation Program For IBM® PC

Utilizing the Serial communications capability of the C48T will require the

use of an RS485 serial card in the computer. If an IBM

®

PC compatible is being

used, this card would be installed in an expansion slot on the mother-board. The
RS485 card should be configured for “2-wire half-duplex” operation. For this
mode of operation, each piece of equipment must be able to switch from receive
mode to transmit mode and vice-versa. The C48T is normally in the receive
mode. It will automatically switch to the transmit mode when a Transmit Value
Command is issued or a Print Request is issued. For the computer to switch
from receive to transmit mode, the controlling software must be written to
perform this task. On most RS485 serial cards, the RTS (Request-to-send)
signal can be configured to be used as the direction (transmit/receive) control
signal. The controlling software must switch the state of the RTS line when the
computer is to switch from transmitting to receiving data.

Listed below is a basic program that will emulate a terminal. It is written

using IBM

®

PC Basic. The program may need to be modified if using a

different basic interpreter. Set up the C48T for a baud rate of 9600. When the
program is running, commands can be typed in from the keyboard as shown in
the previous examples above. An asterisk (*) is used to end all commands. Do
NOT use the carriage return to end a command.

1 REM “FOR THIS PROGRAM TO WORK THE “RS485” CARD SHOULD BE
SET-UP AS COM2”
2 REM “ALSO THE CARD SHOULD USE “RTS” FOR HANDSHAKING”
3 REM “THE C48T UNIT SHOULD BE SET-UP FOR 9600 BAUD, AND ODD
PARITY”
4 TXEMPTY = &H60
5 LSR = &H2FD: REM “COMM2 LINE STATUS REGISTER”
6 MCR = &H2FC: REM “COMM2 MODEM CONTROL REGISTER”
10 CLS : CLOSE :
20 OPEN “COM2:9600,O,7,1” FOR RANDOM AS #1
30 ON TIMER(1) GOSUB 300
40 A$ = INKEY$: IF A$ “ “ THEN GOTO 1000: REM “CHECK FOR KEYBOARD
INPUT”
50 IF LOC(1) = 0 THEN 40 ELSE 80: REM CHECK FOR INPUT
60 IF LOC(1) = 0 THEN 80: REM “SKIP CLEARING OF BUFFER”
70 B$ = INPUT$(LOC(1), #1): REM “CLEAR BUFFER”

80 F = INP (MCR) AND 253: OUT MCR, F: REM “SET FOR RECEIVE MODE”
90 IF INP(LSR) TXEMPTY THEN 90: REM “WAIT UNTIL DONE
TRANSMITTING”
100 TIMER ON
110 IF LOC(1) = 0 THEN 110
120 B$ = INPUT$(1, #1)
130 IF B$ = CHR$(10) THEN 160” REM “TO PREVENT DOUBLE SPACING ON
PRINT”
140 PRINT B$;
160 IF NOT B$ = “ “ THEN GOTO 90
170 TIMER OFF
200 GOTO 40
300 TIMER OFF: RETURN 40
1000 D = INP(MCR) OR 2: OUT MCR, D: REM “SET FOR TRANSMIT MODE”
1010 PRINT #1, A$; : PRINT A$; : REM “PRINT KEYSTROKE”
1020 IF A$ = “*” THEN PRINT
1030 IF A$ = “*” THEN IF INP(LSR) TXEMPTY THEN 1030 ELSE GOTO 60
1040 A$ = INKEY$: IF A$ “ “ THEN GOTO 1000
1050 GOTO 1010

Serial Connections

When wiring, refer to the numbers listed on the label with the terminal

description for installing each wire in its proper location.

For RS-485, the data (transceiver) wires connect to the A(+) and B(-)

terminals. It is recommended that shielded (screened) cable be used for serial
communications. In some applications, a signal ground may be required to
establish a ground reference. The signal ground is required if the equipment
does not have internal bias resistors connected to the transceiver lines. If
necessary, the shield can be used as the signal ground.

TERMINAL DESCRIPTIONS

COMM. - Common required for communication hook-up.
A (+) & B (-) - The C48T transmits and receives on these two terminals which
are connected to the external device.

-27-

C48t-im.QXD 3/5/04 3:29 PM Page 27

Advertising