EasyManuals Logo
Home>Omron>Controller>CPM1

Omron CPM1 Programming Manual

Omron CPM1
541 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #121 background imageLoading...
Page #121 background image
100
Communications Functions Section 1-9
Example Program This example shows a BASIC program that reads the status of the SRM1’s
inputs in IR 000. For more details, refer to SECTION 6 Host Link Commands.
An FCS (frame check sequence) check isn’t performed on the received
response data in this program. Be sure that the host computer’s RS-232C port
is configured correctly before executing the program.
1000 ’ ----------------------------------------------
1010 ’SRM1 Sample Program for PC-9801 N88-BASIC
1020 ’
1050 ’ ----------------------------------------------
1060 ’Set value RS-232C SPEED:9600BPS,PARITY:EVEN,DA-
TA:7,STOP:2--
1070 OPEN ”COM:E73” AS #1
1080 *REPEAT
1090 ’---Transmission data input --------------------
1100 INPUT ”send data:”,SEND$
1110 ’---FCS Calculation ----------------------------
1120 FCS=0
1130 FOR IFCS=1 TO LEN(SEND$)
1140 FCS=FCS XOR ASC(MID$(SEND$;IFCS,1)
1150 NEXT
1160 FCS$=RIGHT$(”0”+HEX$(FCS),2)
1170 ’---Communications execute ---------------------
1180 ZZZ$=SEND$+FCS$+”*”+CHR$(13)
1190 PRINT #1,ZZZ$;
1200 ’---Response check -----------------------------
1210 RECCNT=0:TMP$=””
1220 *DRECLOOP
1230 IF LOC(1)<>0 THEN *DREC1
1240 RECCNT=RECCNT+1
1250 IF RECCNT=5000 THEN *DRECERR ELSE *DRECLOOP
1260 *DREC1
1270 TMP$=TMP$+INPUT$(LOC(1),#1)
1280 IF RIGHT$(TMP$,1)=CHR$(13) THEN *DRECEND ELSE
RECCNT=0:GOTO *DRECLOOP
1290 *DRECERR
1300 TMP$=”No response!!”+CHR$(13)
1310 *DRECEND
1320 RECV$=TMP$
1330 PRINT ”receive data:”;RECV$
1340 ’---Go to transmission data input --------------
1350 GOTO *REPEAT
1360 ’---Processing complete ------------------------
1370 CLOSE #1
1380 END
1-9-6 RS-232C Communications (CQM1/SRM1 Only)
This section explains RS-232C communications. By using RS-232C commu-
nications, the data can be printed out by a printer or read by a bar code
reader. Handshaking is not supported for RS-232C communications.
Communications Procedure
Transmissions
1,2,3... 1. Check to see that AR 0805 (the RS-232C Port Transmit Ready Flag) has
turned ON.

Table of Contents

Other manuals for Omron CPM1

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron CPM1 and is the answer not in the manual?

Omron CPM1 Specifications

General IconGeneral
BrandOmron
ModelCPM1
CategoryController
LanguageEnglish

Related product manuals