Omron CQM1H-SCB41 Computer Hardware User Manual


 
4-4SectionConnections
48
The TXD(––) instruction can be used to transmit data from the PCs data area to
the host computer. There is no response from the host computer. The TXD(––)
instruction will be executed after the response has been transmitted if TXD(––)
is executed while a response to a Host Link command is being returned to the
host computer.
No response
Text
@ Unit No.
Header code
FCS
Terminator
Host
computer
PC
4-4-2 Example Programs
The following type of program must be prepared in the host computer to receive
the data. This program allows the computer to read and display the data re-
ceived from the PC while a Host Link read command is being executed to read
data from the PC.
10 ’CQM1H SAMPLE PROGRAM FOR EXCEPTION
20 CLOSE 1
30 CLS
40 OPEN ”COM:E73” AS #1
50 KEYIN
60 INPUT ”DATA ––––––––”,S$
70 IF S$=” ” THEN GOTO 190
80 PRINT ”SEND DATA = ”;S$
90 ST$=S$
100 INPUT ”SEND OK? Y or N?=”,B$
110 IF B$=”Y” THEN GOTO 130 ELSE GOTO KEYIN
120 S$=ST$
130 PRINT #1,S$ Sends command to PC
140 INPUT #1,R$ Receives response from PC
150 PRINT ”RECV DATA = ”;R$
160 IF MID$(R$,4,2)=”EX” THEN GOTO 210 ’Identifies command from PC
170 IF RIGHT$(R$,1)<>”” THEN S$=” ”:GOTO 130
180 GOTO KEYIN
190 CLOSE 1
200 END
210 PRINT ”EXCEPTION!! DATA”
220 GOTO 140
This example shows a BASIC subroutine program for executing an FCS check
on a frame received by the host computer.
400 *FCSCHECK
410 L=LEN(RESPONSE$)
420 Q=0:FCSCK$=” ”
430 A$=RIGHT$(RESPONSE$,1)
440 PRINT RESPONSE$,A$,L
450 IF A$=”*” THEN LENGS=LEN(RESPONSE$)-3
ELSE LENGS=LEN(RESPONSE$)-2
460 FCSP$=MID$(RESPONSE$,LENGS+1,2) ’ FCS data received. . . .
470 FOR I=1 TO LENGS ’ Number of characters in FCS. . . . . . . . . . .
Using the TXD(––)
Instruction
Command Transmission
Example Program for
FCS